update go docs and examples

This commit is contained in:
darrell-thobe-sp
2025-05-13 11:12:04 -04:00
parent 43fe2ffd30
commit d89039d220
580 changed files with 62492 additions and 25327 deletions

View File

@@ -77,12 +77,13 @@ import (
"context"
"fmt"
"os"
v3 "github.com/sailpoint-oss/golang-sdk/v2/api_v3"
openapiclient "github.com/sailpoint-oss/golang-sdk/v2"
"encoding/json"
v3 "github.com/sailpoint-oss/golang-sdk/v2/api_v3"
sailpoint "github.com/sailpoint-oss/golang-sdk/v2"
)
func main() {
segment := fmt.Sprintf(`{
data := []byte(`{
"owner" : {
"name" : "support",
"id" : "2c9180a46faadee4016fb4e018c20639",
@@ -105,11 +106,20 @@ func main() {
"description" : "This segment represents xyz",
"active" : true,
"id" : "0f11f2a4-7c94-4bf3-a2bd-742580fe3bde"
}`) # Segment |
}`) // Segment |
configuration := NewDefaultConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.V3.SegmentsAPI.CreateSegment(context.Background()).Segment(segment).Execute()
var segment v3.Segment
if err := json.Unmarshal(data, &segment); err != nil {
fmt.Println("Error:", err)
return
}
configuration := sailpoint.NewDefaultConfiguration()
apiClient := sailpoint.NewAPIClient(configuration)
resp, r, err := apiClient.V3.SegmentsAPI.CreateSegment(context.Background()).Segment(segment).Execute()
//resp, r, err := apiClient.V3.SegmentsAPI.CreateSegment(context.Background()).Segment(segment).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SegmentsAPI.CreateSegment``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@@ -163,16 +173,20 @@ import (
"context"
"fmt"
"os"
v3 "github.com/sailpoint-oss/golang-sdk/v2/api_v3"
openapiclient "github.com/sailpoint-oss/golang-sdk/v2"
sailpoint "github.com/sailpoint-oss/golang-sdk/v2"
)
func main() {
id := ef38f94347e94562b5bb8424a56397d8 # string | The segment ID to delete. # string | The segment ID to delete.
id := `ef38f94347e94562b5bb8424a56397d8` // string | The segment ID to delete. # string | The segment ID to delete.
configuration := NewDefaultConfiguration()
apiClient := NewAPIClient(configuration)
r, err := apiClient.V3.SegmentsAPI.DeleteSegment(context.Background(), id).Execute()
configuration := sailpoint.NewDefaultConfiguration()
apiClient := sailpoint.NewAPIClient(configuration)
r, err := apiClient.V3.SegmentsAPI.DeleteSegment(context.Background(), id).Execute()
//r, err := apiClient.V3.SegmentsAPI.DeleteSegment(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SegmentsAPI.DeleteSegment``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@@ -223,16 +237,20 @@ import (
"context"
"fmt"
"os"
v3 "github.com/sailpoint-oss/golang-sdk/v2/api_v3"
openapiclient "github.com/sailpoint-oss/golang-sdk/v2"
sailpoint "github.com/sailpoint-oss/golang-sdk/v2"
)
func main() {
id := ef38f94347e94562b5bb8424a56397d8 # string | The segment ID to retrieve. # string | The segment ID to retrieve.
id := `ef38f94347e94562b5bb8424a56397d8` // string | The segment ID to retrieve. # string | The segment ID to retrieve.
configuration := NewDefaultConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.V3.SegmentsAPI.GetSegment(context.Background(), id).Execute()
configuration := sailpoint.NewDefaultConfiguration()
apiClient := sailpoint.NewAPIClient(configuration)
resp, r, err := apiClient.V3.SegmentsAPI.GetSegment(context.Background(), id).Execute()
//resp, r, err := apiClient.V3.SegmentsAPI.GetSegment(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SegmentsAPI.GetSegment``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@@ -283,18 +301,22 @@ import (
"context"
"fmt"
"os"
v3 "github.com/sailpoint-oss/golang-sdk/v2/api_v3"
openapiclient "github.com/sailpoint-oss/golang-sdk/v2"
sailpoint "github.com/sailpoint-oss/golang-sdk/v2"
)
func main() {
limit := 250 # int32 | Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 250) # int32 | Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 250)
offset := 0 # int32 | Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 0) # int32 | Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 0)
count := true # bool | If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to false) # bool | If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to false)
limit := 250 // int32 | Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 250) # int32 | Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 250)
offset := 0 // int32 | Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 0) # int32 | Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 0)
count := true // bool | If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to false) # bool | If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to false)
configuration := NewDefaultConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.V3.SegmentsAPI.ListSegments(context.Background()).Limit(limit).Offset(offset).Count(count).Execute()
configuration := sailpoint.NewDefaultConfiguration()
apiClient := sailpoint.NewAPIClient(configuration)
resp, r, err := apiClient.V3.SegmentsAPI.ListSegments(context.Background()).Execute()
//resp, r, err := apiClient.V3.SegmentsAPI.ListSegments(context.Background()).Limit(limit).Offset(offset).Count(count).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SegmentsAPI.ListSegments``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
@@ -349,17 +371,27 @@ import (
"context"
"fmt"
"os"
v3 "github.com/sailpoint-oss/golang-sdk/v2/api_v3"
openapiclient "github.com/sailpoint-oss/golang-sdk/v2"
"encoding/json"
v3 "github.com/sailpoint-oss/golang-sdk/v2/api_v3"
sailpoint "github.com/sailpoint-oss/golang-sdk/v2"
)
func main() {
id := ef38f94347e94562b5bb8424a56397d8 # string | The segment ID to modify. # string | The segment ID to modify.
requestBody := fmt.Sprintf(`[{op=replace, path=/visibilityCriteria, value={expression={operator=AND, children=[{operator=EQUALS, attribute=location, value={type=STRING, value=Philadelphia}}, {operator=EQUALS, attribute=department, value={type=STRING, value=HR}}]}}}]`) # []map[string]interface{} | A list of segment update operations according to the [JSON Patch](https://tools.ietf.org/html/rfc6902) standard. The following fields are patchable: * name * description * owner * visibilityCriteria * active
id := `ef38f94347e94562b5bb8424a56397d8` // string | The segment ID to modify. # string | The segment ID to modify.
requestBody := fmt.Sprintf(`[{op=replace, path=/visibilityCriteria, value={expression={operator=AND, children=[{operator=EQUALS, attribute=location, value={type=STRING, value=Philadelphia}}, {operator=EQUALS, attribute=department, value={type=STRING, value=HR}}]}}}]`) // []map[string]interface{} | A list of segment update operations according to the [JSON Patch](https://tools.ietf.org/html/rfc6902) standard. The following fields are patchable: * name * description * owner * visibilityCriteria * active
configuration := NewDefaultConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.V3.SegmentsAPI.PatchSegment(context.Background(), id).RequestBody(requestBody).Execute()
var requestBody v3.RequestBody
if err := json.Unmarshal(data, &requestBody); err != nil {
fmt.Println("Error:", err)
return
}
configuration := sailpoint.NewDefaultConfiguration()
apiClient := sailpoint.NewAPIClient(configuration)
resp, r, err := apiClient.V3.SegmentsAPI.PatchSegment(context.Background(), id).RequestBody(requestBody).Execute()
//resp, r, err := apiClient.V3.SegmentsAPI.PatchSegment(context.Background(), id).RequestBody(requestBody).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SegmentsAPI.PatchSegment``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)