mirror of
https://github.com/LukeHagar/sailpoint-cli.git
synced 2025-12-09 12:47:44 +00:00
SDK templates
This commit is contained in:
@@ -1 +0,0 @@
|
||||
HEYOOOOO
|
||||
16
cmd/sdk/typescript/package.json
Normal file
16
cmd/sdk/typescript/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "sailpoint-sdk",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"scripts": {
|
||||
"start": "ts-node src/index.ts",
|
||||
"build": "tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4",
|
||||
"sailpoint-api-client": "^1.0.4"
|
||||
}
|
||||
}
|
||||
85
cmd/sdk/typescript/src/index.ts
Normal file
85
cmd/sdk/typescript/src/index.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import { AccountsApi, Configuration, axiosRetry, Paginator, SearchApi, TransformsApi, TransformsApiCreateTransformRequest, Search, IdentityDocument} from "sailpoint-api-client"
|
||||
|
||||
const createTransform = async () => {
|
||||
|
||||
let apiConfig = new Configuration()
|
||||
let api = new TransformsApi(apiConfig)
|
||||
let transform: TransformsApiCreateTransformRequest =
|
||||
{
|
||||
transform:
|
||||
{
|
||||
name: "Test Transform",
|
||||
type: "dateFormat",
|
||||
attributes: {
|
||||
inputFormat: "MMM dd yyyy, HH:mm:ss.SSS",
|
||||
outputFormat: "yyyy/dd/MM"
|
||||
}
|
||||
}
|
||||
}
|
||||
const val = await api.createTransform(transform)
|
||||
console.log(val)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
for (const result of val.data) {
|
||||
const castedResult: IdentityDocument = result
|
||||
console.log(castedResult.name)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
const val = await Paginator.paginate(api, api.listAccounts, {limit: 100}, 10)
|
||||
|
||||
console.log(val)
|
||||
|
||||
}
|
||||
|
||||
|
||||
const getPaginatedTransforms = 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 TransformsApi(apiConfig)
|
||||
|
||||
const val = await Paginator.paginate(api, api.listTransforms, {limit: 250}, 100)
|
||||
|
||||
console.log(val.data.length)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
getPaginatedTransforms()
|
||||
16
cmd/sdk/typescript/tsconfig.json
Normal file
16
cmd/sdk/typescript/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
"module": "commonjs", /* Specify what module code is generated. */
|
||||
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"skipLibCheck": true,
|
||||
"outDir": "./build",
|
||||
"rootDir": "src",
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user