Prettified Code!

This commit is contained in:
darrell-thobe-sp
2024-04-18 10:31:05 +00:00
committed by GitHub Action
parent f5b6aaf14f
commit 2cd5ccfc81
223 changed files with 40526 additions and 28073 deletions

View File

@@ -1,5 +1,5 @@
{
"customProps": {
"description": "Streamlined development in your language of choice"
}
}
"customProps": {
"description": "Streamlined development in your language of choice"
}
}

View File

@@ -6,7 +6,7 @@ sidebar_label: Create a resource
sidebar_position: 2
sidebar_class_name: gosdk
keywords: ['go', 'golang', 'sdk', 'create']
description: Learn how to create new resources the Golang SDK in this guide.
description: Learn how to create new resources the Golang SDK in this guide.
slug: /tools/sdk/go/create
tags: ['SDK', 'Software Development Kit']
---

View File

@@ -6,7 +6,7 @@ sidebar_label: Delete a resource
sidebar_position: 4
sidebar_class_name: gosdk
keywords: ['go', 'golang', 'sdk', 'delete']
description: Learn how to delete resources with the Golang SDK in this guide.
description: Learn how to delete resources with the Golang SDK in this guide.
slug: /tools/sdk/go/delete
tags: ['SDK', 'Software Development Kit']
---
@@ -49,7 +49,7 @@ func main() {
}
```
To run the code, run this command:
To run the code, run this command:
```go
go run sdk.go

View File

@@ -6,7 +6,7 @@ sidebar_label: Error Handling
sidebar_position: 8
sidebar_class_name: gosdk
keywords: ['go', 'golang', 'sdk', 'error']
description: Learn how to handle errors with the Golang SDK in this guide.
description: Learn how to handle errors with the Golang SDK in this guide.
slug: /tools/sdk/go/error-handling
tags: ['SDK', 'Software Development Kit']
---

View File

@@ -6,7 +6,7 @@ sidebar_label: Getting Started
sidebar_position: 1
sidebar_class_name: gosdk
keywords: ['go', 'golang', 'sdk', 'start']
description: Learn how to use the Golang SDK in this guide.
description: Learn how to use the Golang SDK in this guide.
slug: /tools/sdk/go/getting-started
tags: ['SDK', 'Software Development Kit']
---

View File

@@ -6,7 +6,7 @@ sidebar_label: Paginate Results
sidebar_position: 5
sidebar_class_name: gosdk
keywords: ['go', 'golang', 'sdk', 'paginate']
description: Learn how to paginate results with the Golang SDK in this guide.
description: Learn how to paginate results with the Golang SDK in this guide.
slug: /tools/sdk/go/paginate
tags: ['SDK', 'Software Development Kit']
---

View File

@@ -6,12 +6,12 @@ sidebar_label: Retries
sidebar_position: 7
sidebar_class_name: gosdk
keywords: ['go', 'golang', 'sdk', 'retry']
description: Learn how to paginate results with the Golang SDK in this guide.
description: Learn how to paginate results with the Golang SDK in this guide.
slug: /tools/sdk/go/retries
tags: ['SDK', 'Software Development Kit']
---
The SDK uses the [go-retryablehttp](https://github.com/hashicorp/go-retryablehttp) module to support retry logic.
The SDK uses the [go-retryablehttp](https://github.com/hashicorp/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:

View File

@@ -6,7 +6,7 @@ sidebar_label: Search
sidebar_position: 5
sidebar_class_name: gosdk
keywords: ['go', 'golang', 'sdk', 'search']
description: Learn how to search with the Golang SDK in this guide.
description: Learn how to search with the Golang SDK in this guide.
slug: /tools/sdk/go/search
tags: ['SDK', 'Software Development Kit']
---
@@ -85,4 +85,4 @@ resp, r, err := sailpoint.PaginateSearchApi(ctx, apiClient, *search, 0, 10, 1000
The first value refers to the `initialOffset`, the starting number for the results, the second refers to the `increment`, the number of records per page, and the third refers to the `limit`, the last record that can be returned.
For example, changing the first number to `21`, the second to `20`, and the third to `40` would configure the search to return records 21 to 40 and then stop.
For example, changing the first number to `21`, the second to `20`, and the third to `40` would configure the search to return records 21 to 40 and then stop.

View File

@@ -6,7 +6,7 @@ sidebar_label: Update a resource
sidebar_position: 3
sidebar_class_name: gosdk
keywords: ['go', 'golang', 'sdk', 'update']
description: Learn how to update resources with the Golang SDK.
description: Learn how to update resources with the Golang SDK.
slug: /tools/sdk/go/update
tags: ['SDK', 'Software Development Kit']
---
@@ -57,7 +57,7 @@ func main() {
```
To run the code, run this command:
To run the code, run this command:
```go
go run sdk.go
@@ -79,4 +79,4 @@ The updated WorkGroup will be returned by the SDK:
"type": "IDENTITY"
}
}
```
```

View File

@@ -13,7 +13,7 @@ tags: ['SDK']
## Overview
The SailPoint software development kits (SDKs) make it easier for developers to leverage the Identity Security Cloud (ISC) APIs, extensibility options, and connectivity while they build with their preferred coding languages.
The SailPoint software development kits (SDKs) make it easier for developers to leverage the Identity Security Cloud (ISC) APIs, extensibility options, and connectivity while they build with their preferred coding languages.
```mdx-code-block
import DocCardList from '@theme/DocCardList';
@@ -22,8 +22,8 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
<DocCardList items={useCurrentSidebarCategory().items}/>
```
## Discuss
## Discuss
The most valuable resource for ISC developers is the SailPoint Developer Community itself, where ISC users and experts all over the world come together to ask questions and provide solutions.
The most valuable resource for ISC developers is the SailPoint Developer Community itself, where ISC users and experts all over the world come together to ask questions and provide solutions.
To learn more about the ISC SDKs and discuss them with SailPoint Developer Community members, go to the [SailPoint Developer Community Forum](https://developer.sailpoint.com/discuss/c/isc/6).
To learn more about the ISC SDKs and discuss them with SailPoint Developer Community members, go to the [SailPoint Developer Community Forum](https://developer.sailpoint.com/discuss/c/isc/6).

View File

@@ -19,7 +19,7 @@ To see a list of available create cmdlets, run this command:
Get-Command -Module PSSailpoint | where-object {$_.name -like "*New-*" } | Sort-Object Name | Get-Help | Format-Table Name, Synopsis
```
The SDK returns this output (all beta endpoints are designated by the Beta prefix):
The SDK returns this output (all beta endpoints are designated by the Beta prefix):
```powershell
Name Synopsis
@@ -60,10 +60,10 @@ $JSON = @"
$WorkGroup = ConvertFrom-BetaJsonToWorkgroupDto -Json $JSON
$WorkGroup = Initialize-BetaWorkgroupDto -Name "DB Access Governance Group" -Description "Description of the Governance Group" -Owner @{
$WorkGroup = Initialize-BetaWorkgroupDto -Name "DB Access Governance Group" -Description "Description of the Governance Group" -Owner @{
"type" = "IDENTITY"
"id" = $Identity.id
"name" = $Identity.name
"name" = $Identity.name
}
New-BetaWorkgroup -WorkgroupDto $WorkGroup
@@ -86,6 +86,6 @@ memberCount 0
connectionCount 0
id a241d625-d948-4c41-839e-869b790837a1
name DB Access Governance Group
created
modified
created
modified
```

View File

@@ -26,7 +26,7 @@ Using the [WithHttpInfo Switch](./getting-started.md#withhttpinfo-switch) in the
```powershell
Name Value
---- -----
Response
Response
StatusCode 204
Headers {[Date, System.String[]], [Connection, System.String[]], [Server, System.String[]], [Vary, System.String[]]}
```

View File

@@ -18,7 +18,7 @@ You can use a `try/catch` function to intercept any non success response and tak
```powershell
# Catch any non 2xx response and log the status code and error message
try {
Get-Transforms -Filters "id eq"
Get-Transforms -Filters "id eq"
}
catch {
Write-Host $_.Exception.Response.StatusCode.value__
@@ -33,7 +33,7 @@ This code ensures that the `Get-AccessProfiles` cmdlet will never be called:
```powershell
# Catch any non 2xx response and log the status code and error message. Stop the script with the Exit keyword.
try {
Get-Transforms -Filters "id eq"
Get-Transforms -Filters "id eq"
}
catch {
Write-Host $_.Exception.Response.StatusCode.value__

View File

@@ -71,42 +71,42 @@ Get-Help Get-Transforms -Detailed
```text
NAME
Get-Transforms
SYNOPSIS
List transforms
SYNTAX
Get-Transforms [[-Offset] <Nullable`1>] [[-Limit] <Nullable`1>] [[-Count] <Nullable`1>] [[-Name] <String>] [[-Filters] <String>] [-WithHttpInfo] [<CommonParameters>]
DESCRIPTION
Gets a list of all saved transform objects. A token with 'transforms-list read' authority is required to call this API.
PARAMETERS
-Offset <Nullable`1>
Offset into the full result set. Usually specified with *limit* to paginate through the results. For more information, refer to [V3 API Standard Collection
Offset into the full result set. Usually specified with *limit* to paginate through the results. For more information, refer to [V3 API Standard Collection
Parameters](https://developer.sailpoint.com/docs/api/standard-collection-parameters).
-Limit <Nullable`1>
Max number of results to return. For more information, refer to [V3 API Standard Collection Parameters](https://developer.sailpoint.com/docs/api/standard-collection-parameters).
-Count <Nullable`1>
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. For more information, refer to [V3 API Standard Collection
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. For more information, refer to [V3 API Standard Collection
Parameters](https://developer.sailpoint.com/docs/api/standard-collection-parameters).
-Name <String>
Name of the transform to retrieve from the list.
-Filters <String>
Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/docs/api/standard-collection-parameters#filtering-results). Filtering is
Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/docs/api/standard-collection-parameters#filtering-results). Filtering is
supported for the following fields and operators: **internal**: *eq* **name**: *eq, sw*
-WithHttpInfo [<SwitchParameter>]
A switch that, when enabled, will return a hash table of Response, StatusCode and Headers, instead of just the Response.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,

View File

@@ -32,7 +32,6 @@ try {
}
```
The `Invoke-Paginate` cmdlet takes a few paramters. The first is the cmdlet you wish to call.
The `-Function` specifies the name of the cmdlet you wish to call. This only works on list endpoints.
@@ -43,6 +42,6 @@ The `-Limit` specifies the total number of results you can return, 1000.
The `-Parameters` specifies a hashtable of additional values passed to the API endpoint. You would use this for `filters`, `sorters`, and any other query parameters.
You can also provide an `-InitialOffset` value to specify the record number to start the request on. For example, you can provide add `-InitialOffset 10` to start getting accounts from 11 instead of 0.
You can also provide an `-InitialOffset` value to specify the record number to start the request on. For example, you can provide add `-InitialOffset 10` to start getting accounts from 11 instead of 0.
To find out whether an endpoint supports pagination, refer to its documentation. Any API supporting pagination lists the optional query parameters detailed in [Paginating Results](/docs/api/standard-collection-parameters/#paginating-results).

View File

@@ -11,11 +11,10 @@ slug: /tools/sdk/powershell/retries
tags: ['SDK']
---
The SDK supports retry logic in the case of an unexpected error. You have these two retry configuration options:
* MaximumRetryCount - How many times to retry the request. Default is 10 retries.
* RetryIntervalSeconds - How many seconds to wait between retries. Default is 5 seconds.
- MaximumRetryCount - How many times to retry the request. Default is 10 retries.
- RetryIntervalSeconds - How many seconds to wait between retries. Default is 5 seconds.
The following code will tell the SDK to retry 2 times after an unexpected error and wait 3 seconds between retries.

View File

@@ -19,7 +19,7 @@ To see a list of available create cmdlets, run this command:
Get-Command -Module PSSailpoint | where-object {$_.name -like "*Update-*" } | Sort-Object Name | Get-Help | Format-Table Name, Synopsis
```
The SDK returns this output (all beta endpoints are designated by the Beta prefix):
The SDK returns this output (all beta endpoints are designated by the Beta prefix):
```powershell
Name Synopsis

View File

@@ -16,33 +16,37 @@ You can use the SDK to create new resources.
Here is an example create workgroup script from the beta APIs you can copy into your typescript project to try it out:
```typescript showLineNumbers
import {Configuration, GovernanceGroupsBetaApi, GovernanceGroupsBetaApiCreateWorkgroupRequest, PublicIdentitiesApi} from "sailpoint-api-client"
import {
Configuration,
GovernanceGroupsBetaApi,
GovernanceGroupsBetaApiCreateWorkgroupRequest,
PublicIdentitiesApi,
} from 'sailpoint-api-client';
const createWorkGroup = async () => {
let apiConfig = new Configuration()
let identitiesApi = new PublicIdentitiesApi(apiConfig)
let apiConfig = new Configuration();
let identitiesApi = new PublicIdentitiesApi(apiConfig);
let identity = (await identitiesApi.getPublicIdentities({limit: 1})).data[0]
let identity = (await identitiesApi.getPublicIdentities({limit: 1})).data[0];
let api = new GovernanceGroupsBetaApi(apiConfig)
let workgroup: GovernanceGroupsBetaApiCreateWorkgroupRequest = {
workgroupDtoBeta: {
name: "DB Access Governance Group",
description: "Description of the Governance Group",
owner: {
id: identity.id,
type: "IDENTITY",
name: identity.name
}
}
}
let api = new GovernanceGroupsBetaApi(apiConfig);
let workgroup: GovernanceGroupsBetaApiCreateWorkgroupRequest = {
workgroupDtoBeta: {
name: 'DB Access Governance Group',
description: 'Description of the Governance Group',
owner: {
id: identity.id,
type: 'IDENTITY',
name: identity.name,
},
},
};
let val = await api.createWorkgroup(workgroup)
console.log(val.data)
let val = await api.createWorkgroup(workgroup);
console.log(val.data);
};
}
createWorkGroup()
createWorkGroup();
```
Run this command to compile and run the code:
@@ -73,5 +77,5 @@ The WorkGroup will be returned by the SDK:
name: 'DB Access Governance Group',
created: null,
modified: null
}
}
```

View File

@@ -16,23 +16,31 @@ You can use the SDK to delete resources.
Here is an example script that searches for the Workgroup created in [Create a resource](./creating-resources.md) by name and calls the delete method to remove it from your environment.
```typescript
import {Configuration, GovernanceGroupsBetaApi, GovernanceGroupsBetaApiCreateWorkgroupRequest, GovernanceGroupsBetaApiPatchWorkgroupRequest, PublicIdentitiesApi} from "sailpoint-api-client"
import {
Configuration,
GovernanceGroupsBetaApi,
GovernanceGroupsBetaApiCreateWorkgroupRequest,
GovernanceGroupsBetaApiPatchWorkgroupRequest,
PublicIdentitiesApi,
} from 'sailpoint-api-client';
const deleteWorkgroup = async () => {
let apiConfig = new Configuration()
let api = new GovernanceGroupsBetaApi(apiConfig)
let apiConfig = new Configuration();
let api = new GovernanceGroupsBetaApi(apiConfig);
let workgroup = (await api.listWorkgroups({filters: 'name eq "DB Access Governance Group"'})).data[0]
let workgroup = (
await api.listWorkgroups({filters: 'name eq "DB Access Governance Group"'})
).data[0];
if (workgroup.id !== undefined) {
let deletionStatus = (await api.deleteWorkgroup({id: workgroup.id})).status
console.log(deletionStatus)
} else {
console.log("Workgroup was not found, id is missing for delete request.")
}
}
if (workgroup.id !== undefined) {
let deletionStatus = (await api.deleteWorkgroup({id: workgroup.id})).status;
console.log(deletionStatus);
} else {
console.log('Workgroup was not found, id is missing for delete request.');
}
};
deleteWorkgroup()
deleteWorkgroup();
```
Run this command to compile and run the code:

View File

@@ -18,10 +18,10 @@ The first method is to use a `catch` function to intercept any unsuccessful resp
```typescript showLineNumbers
// Catch any non 2xx response and log the error message and metadata
let transforms = await api.listTransforms().catch(function (error) {
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
})
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
});
```
The second method is to define which HTTP status codes should throw an error for a given request using the `validateStatus` option. This gives you an opportunity to recover from a bad request without exiting the program.
@@ -30,17 +30,31 @@ If you don't want the program to exit for 4xx response codes, you can use this c
```typescript showLineNumbers
// Resolve only if the status code is less than 500
let transforms = await api.listTransforms({filters: 'id eq'}, {validateStatus: function (status) { return status < 500 }})
let transforms = await api.listTransforms(
{filters: 'id eq'},
{
validateStatus: function (status) {
return status < 500;
},
},
);
if (transforms.status === 200) {
console.log(transforms)
} else if (transforms.status === 400 ) {
console.log("The filter is invalid. Continuing execution.")
console.log(transforms);
} else if (transforms.status === 400) {
console.log('The filter is invalid. Continuing execution.');
}
```
If you don't want the program to exit for any error response, you can use this configuration:
```typescript
await api.listTransforms({}, {validateStatus: function (status) { return true }})
await api.listTransforms(
{},
{
validateStatus: function (status) {
return true;
},
},
);
```

View File

@@ -20,23 +20,23 @@ To make sure that your SDK is connecting to the APIs you need, you can specify t
### List Transforms in your tenant
```typescript
import {Configuration, TransformsApi} from "sailpoint-api-client"
import {Configuration, TransformsApi} from 'sailpoint-api-client';
const getTransforms = async() => {
// Initialize configuration, this requests a token using your configured credentials
// to be able to call out to APIs
let apiConfig = new Configuration()
const getTransforms = async () => {
// Initialize configuration, this requests a token using your configured credentials
// to be able to call out to APIs
let apiConfig = new Configuration();
// Initialize the TransformsApi, this creates an instance of the TransformsApi.
// The configuration object is passed in so that the API can add your token to the request
let api = new TransformsApi(apiConfig)
// Initialize the TransformsApi, this creates an instance of the TransformsApi.
// The configuration object is passed in so that the API can add your token to the request
let api = new TransformsApi(apiConfig);
// Call out to your tenant to get the list of transforms.
let transforms = await api.listTransforms()
console.log(transforms)
}
// Call out to your tenant to get the list of transforms.
let transforms = await api.listTransforms();
console.log(transforms);
};
getTransforms()
getTransforms();
```
To compile the file, first run the `tsc src/index.ts` command. This command creates a corresponding `index.js` file you can use to run the SDK.
@@ -50,16 +50,19 @@ Using the same SDK function, you can list your transforms but limit the results
Refer to [List Transforms](https://developer.sailpoint.com/docs/api/v3/list-transforms) for all its supported query parameters.
```typescript
import {Configuration, TransformsApi} from "sailpoint-api-client"
import {Configuration, TransformsApi} from 'sailpoint-api-client';
const getTransforms = async() => {
let apiConfig = new Configuration()
let api = new TransformsApi(apiConfig)
let transforms = await api.listTransforms({limit: 10, filters: 'name sw "Test"'})
console.log(transforms)
}
const getTransforms = async () => {
let apiConfig = new Configuration();
let api = new TransformsApi(apiConfig);
let transforms = await api.listTransforms({
limit: 10,
filters: 'name sw "Test"',
});
console.log(transforms);
};
getTransforms()
getTransforms();
```
Run this command to compile and run the code:

View File

@@ -16,18 +16,23 @@ By default, your requests will return a maximum of 250 records. To return more,
Pagination is implemented with the SDK in the following code block on line 7:
```typescript showLineNumbers
import {Configuration, AccountsApi, Paginator} from "sailpoint-api-client"
import {Configuration, AccountsApi, Paginator} from 'sailpoint-api-client';
const getPaginatedAccounts = async () => {
let apiConfig = new Configuration()
let api = new AccountsApi(apiConfig)
const val = await Paginator.paginate(api, api.listAccounts, {limit: 1000}, 250)
let apiConfig = new Configuration();
let api = new AccountsApi(apiConfig);
console.log(val)
}
const val = await Paginator.paginate(
api,
api.listAccounts,
{limit: 1000},
250,
);
getPaginatedAccounts()
console.log(val);
};
getPaginatedAccounts();
```
Run this command to compile and run the code:

View File

@@ -14,28 +14,30 @@ tags: ['SDK']
The SDK supports retry logic in the case of an unexpected error. You are able to configure the number of retries and the delay between retries. This logic is implemented in lines 7-12:
```typescript showLineNumbers
import {Configuration, axiosRetry, AccountsApi, Paginator} from "sailpoint-api-client"
import {
Configuration,
axiosRetry,
AccountsApi,
Paginator,
} from 'sailpoint-api-client';
const getPaginatedAccounts = async () => {
let apiConfig = new Configuration();
apiConfig.retriesConfig = {
retries: 4,
retryDelay: axiosRetry.exponentialDelay,
onRetry(retryCount, error, requestConfig) {
console.log(`retrying due to request error, try number ${retryCount}`);
},
};
let api = new AccountsApi(apiConfig);
let apiConfig = new Configuration()
apiConfig.retriesConfig = {
retries: 4,
retryDelay: axiosRetry.exponentialDelay,
onRetry(retryCount, error, requestConfig) {
console.log(`retrying due to request error, try number ${retryCount}`)
},
}
let api = new AccountsApi(apiConfig)
const val = await Paginator.paginate(api, api.listAccounts, {limit: 100}, 10)
const val = await Paginator.paginate(api, api.listAccounts, {limit: 100}, 10);
console.log(val)
console.log(val);
};
}
getPaginatedAccounts()
getPaginatedAccounts();
```
Run this command to compile and run the code:

View File

@@ -15,25 +15,22 @@ To try using the ISC [search functionality](/docs/api/v3/search-post) along with
```typescript
const search = async () => {
let apiConfig = new Configuration()
let api = new SearchApi(apiConfig)
let search: Search = {
indices: [
"identities"
],
query: {
query: "*"
},
sort: ["-name"]
}
const val = await Paginator.paginateSearchApi(api, search, 100, 1000)
let apiConfig = new Configuration();
let api = new SearchApi(apiConfig);
let search: Search = {
indices: ['identities'],
query: {
query: '*',
},
sort: ['-name'],
};
const val = await Paginator.paginateSearchApi(api, search, 100, 1000);
for (const result of val.data) {
const castedResult: IdentityDocument = result
console.log(castedResult.name)
}
}
for (const result of val.data) {
const castedResult: IdentityDocument = result;
console.log(castedResult.name);
}
};
```
Run this command to compile and run the code:
@@ -44,6 +41,6 @@ tsc src/index.ts && node src/index.js
This example returns 1000 identities, 100 at a time, and sorts them in descending order by name. You can also change the search pagination by changing "100" and "1000", respectively.
The two main ways you can manipulate this example are to change the `indices` or the `query`. For example, if you add `"access profiles"` to the indices, the SDK will search access profiles too. If you change the query to "a*", the search will return all records starting with the letter "a".
The two main ways you can manipulate this example are to change the `indices` or the `query`. For example, if you add `"access profiles"` to the indices, the SDK will search access profiles too. If you change the query to "a\*", the search will return all records starting with the letter "a".
You can also change the sorting logic in the brackets next to `sort`.

View File

@@ -16,31 +16,41 @@ You can use the SDK to update resources.
Here is an example update WorkGroup script which will update the description for the Workgroup created in [Create a Resource](./creating-resources.md):
```typescript
import {Configuration, GovernanceGroupsBetaApi, GovernanceGroupsBetaApiCreateWorkgroupRequest, GovernanceGroupsBetaApiPatchWorkgroupRequest, PublicIdentitiesApi} from "sailpoint-api-client"
import {
Configuration,
GovernanceGroupsBetaApi,
GovernanceGroupsBetaApiCreateWorkgroupRequest,
GovernanceGroupsBetaApiPatchWorkgroupRequest,
PublicIdentitiesApi,
} from 'sailpoint-api-client';
const updateWorkGroup = async () => {
let apiConfig = new Configuration()
let api = new GovernanceGroupsBetaApi(apiConfig)
let apiConfig = new Configuration();
let api = new GovernanceGroupsBetaApi(apiConfig);
let workgroup = (await api.listWorkgroups({filters: 'name eq "DB Access Governance Group"'})).data[0]
let workgroup = (
await api.listWorkgroups({filters: 'name eq "DB Access Governance Group"'})
).data[0];
if (workgroup.id !== undefined) {
let updatedWorkgroup: GovernanceGroupsBetaApiPatchWorkgroupRequest = {
id: workgroup.id,
jsonPatchOperationBeta: [{
op: "replace",
path: "/description",
value: "This is an updated description for the workgroup."
}]
}
let val = await api.patchWorkgroup(updatedWorkgroup)
console.log(val.data)
} else {
console.log("Workgroup was not found, id is missing for patch request.")
}
}
if (workgroup.id !== undefined) {
let updatedWorkgroup: GovernanceGroupsBetaApiPatchWorkgroupRequest = {
id: workgroup.id,
jsonPatchOperationBeta: [
{
op: 'replace',
path: '/description',
value: 'This is an updated description for the workgroup.',
},
],
};
let val = await api.patchWorkgroup(updatedWorkgroup);
console.log(val.data);
} else {
console.log('Workgroup was not found, id is missing for patch request.');
}
};
updateWorkGroup()
updateWorkGroup();
```
Run this command to compile and run the code: