sailpoint-api-client 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/beta/.openapi-generator/FILES +11 -0
  2. package/beta/.openapi-generator/VERSION +1 -0
  3. package/beta/.openapi-generator-ignore +23 -0
  4. package/beta/README.md +45 -0
  5. package/beta/api.ts +63833 -0
  6. package/beta/base.ts +71 -0
  7. package/beta/common.ts +141 -0
  8. package/beta/configuration.ts +101 -0
  9. package/beta/git_push.sh +57 -0
  10. package/beta/index.ts +17 -0
  11. package/beta/package.json +35 -0
  12. package/beta/tsconfig.json +21 -0
  13. package/cc/.openapi-generator/FILES +11 -0
  14. package/cc/.openapi-generator/VERSION +1 -0
  15. package/cc/.openapi-generator-ignore +23 -0
  16. package/cc/README.md +45 -0
  17. package/cc/api.ts +2028 -0
  18. package/cc/base.ts +71 -0
  19. package/cc/common.ts +141 -0
  20. package/cc/configuration.ts +101 -0
  21. package/cc/git_push.sh +57 -0
  22. package/cc/index.ts +17 -0
  23. package/cc/package.json +35 -0
  24. package/cc/tsconfig.json +21 -0
  25. package/configuration.ts +217 -0
  26. package/dist/beta/api.d.ts +44076 -0
  27. package/dist/beta/api.js +42294 -0
  28. package/dist/beta/api.js.map +1 -0
  29. package/dist/beta/base.d.ts +55 -0
  30. package/dist/beta/base.js +83 -0
  31. package/dist/beta/base.js.map +1 -0
  32. package/dist/beta/common.d.ts +65 -0
  33. package/dist/beta/common.js +247 -0
  34. package/dist/beta/common.js.map +1 -0
  35. package/dist/beta/configuration.d.ts +83 -0
  36. package/dist/beta/configuration.js +45 -0
  37. package/dist/beta/configuration.js.map +1 -0
  38. package/dist/beta/index.d.ts +12 -0
  39. package/dist/beta/index.js +31 -0
  40. package/dist/beta/index.js.map +1 -0
  41. package/dist/cc/api.d.ts +1163 -0
  42. package/dist/cc/api.js +2047 -0
  43. package/dist/cc/api.js.map +1 -0
  44. package/dist/cc/base.d.ts +55 -0
  45. package/dist/cc/base.js +83 -0
  46. package/dist/cc/base.js.map +1 -0
  47. package/dist/cc/common.d.ts +65 -0
  48. package/dist/cc/common.js +247 -0
  49. package/dist/cc/common.js.map +1 -0
  50. package/dist/cc/configuration.d.ts +83 -0
  51. package/dist/cc/configuration.js +45 -0
  52. package/dist/cc/configuration.js.map +1 -0
  53. package/dist/cc/index.d.ts +12 -0
  54. package/dist/cc/index.js +31 -0
  55. package/dist/cc/index.js.map +1 -0
  56. package/dist/configuration.d.ts +147 -0
  57. package/dist/configuration.js +126 -0
  58. package/dist/configuration.js.map +1 -0
  59. package/dist/index.d.ts +22 -0
  60. package/dist/index.js +47 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/paginator.d.ts +41 -0
  63. package/dist/paginator.js +126 -0
  64. package/dist/paginator.js.map +1 -0
  65. package/dist/v2/api.d.ts +1359 -0
  66. package/dist/v2/api.js +1239 -0
  67. package/dist/v2/api.js.map +1 -0
  68. package/dist/v2/base.d.ts +55 -0
  69. package/dist/v2/base.js +83 -0
  70. package/dist/v2/base.js.map +1 -0
  71. package/dist/v2/common.d.ts +65 -0
  72. package/dist/v2/common.js +247 -0
  73. package/dist/v2/common.js.map +1 -0
  74. package/dist/v2/configuration.d.ts +83 -0
  75. package/dist/v2/configuration.js +45 -0
  76. package/dist/v2/configuration.js.map +1 -0
  77. package/dist/v2/index.d.ts +12 -0
  78. package/dist/v2/index.js +31 -0
  79. package/dist/v2/index.js.map +1 -0
  80. package/dist/v3/api.d.ts +23657 -0
  81. package/dist/v3/api.js +18302 -0
  82. package/dist/v3/api.js.map +1 -0
  83. package/dist/v3/base.d.ts +55 -0
  84. package/dist/v3/base.js +83 -0
  85. package/dist/v3/base.js.map +1 -0
  86. package/dist/v3/common.d.ts +65 -0
  87. package/dist/v3/common.js +247 -0
  88. package/dist/v3/common.js.map +1 -0
  89. package/dist/v3/configuration.d.ts +83 -0
  90. package/dist/v3/configuration.js +45 -0
  91. package/dist/v3/configuration.js.map +1 -0
  92. package/dist/v3/index.d.ts +12 -0
  93. package/dist/v3/index.js +31 -0
  94. package/dist/v3/index.js.map +1 -0
  95. package/index.ts +33 -0
  96. package/package.json +39 -0
  97. package/paginator.ts +99 -0
  98. package/readme.md +53 -0
  99. package/tsconfig.json +22 -0
  100. package/v2/.openapi-generator/FILES +11 -0
  101. package/v2/.openapi-generator/VERSION +1 -0
  102. package/v2/.openapi-generator-ignore +23 -0
  103. package/v2/README.md +45 -0
  104. package/v2/api.ts +1900 -0
  105. package/v2/base.ts +71 -0
  106. package/v2/common.ts +141 -0
  107. package/v2/configuration.ts +101 -0
  108. package/v2/git_push.sh +57 -0
  109. package/v2/index.ts +17 -0
  110. package/v2/package.json +35 -0
  111. package/v2/tsconfig.json +21 -0
  112. package/v3/.openapi-generator/FILES +11 -0
  113. package/v3/.openapi-generator/VERSION +1 -0
  114. package/v3/.openapi-generator-ignore +23 -0
  115. package/v3/README.md +45 -0
  116. package/v3/api.ts +32081 -0
  117. package/v3/base.ts +71 -0
  118. package/v3/common.ts +141 -0
  119. package/v3/configuration.ts +101 -0
  120. package/v3/git_push.sh +57 -0
  121. package/v3/index.ts +17 -0
  122. package/v3/package.json +35 -0
  123. package/v3/tsconfig.json +21 -0
package/cc/base.ts ADDED
@@ -0,0 +1,71 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * IdentityNow cc (private) APIs
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import { Configuration } from "../configuration";
17
+ // Some imports not used depending on template conditions
18
+ // @ts-ignore
19
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
20
+
21
+ export const BASE_PATH = "https://sailpoint.api.identitynow.com".replace(/\/+$/, "");
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ */
27
+ export const COLLECTION_FORMATS = {
28
+ csv: ",",
29
+ ssv: " ",
30
+ tsv: "\t",
31
+ pipes: "|",
32
+ };
33
+
34
+ /**
35
+ *
36
+ * @export
37
+ * @interface RequestArgs
38
+ */
39
+ export interface RequestArgs {
40
+ url: string;
41
+ axiosOptions: AxiosRequestConfig;
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @export
47
+ * @class BaseAPI
48
+ */
49
+ export class BaseAPI {
50
+ protected configuration: Configuration | undefined;
51
+
52
+ constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
53
+ if (configuration) {
54
+ this.configuration = configuration;
55
+ this.basePath = configuration.basePathCC || this.basePath;
56
+ }
57
+ }
58
+ };
59
+
60
+ /**
61
+ *
62
+ * @export
63
+ * @class RequiredError
64
+ * @extends {Error}
65
+ */
66
+ export class RequiredError extends Error {
67
+ name: "RequiredError" = "RequiredError";
68
+ constructor(public field: string, msg?: string) {
69
+ super(msg);
70
+ }
71
+ }
package/cc/common.ts ADDED
@@ -0,0 +1,141 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * IdentityNow cc (private) APIs
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import { Configuration } from "../configuration";
17
+ import { RequiredError, RequestArgs } from "./base";
18
+ import { AxiosInstance, AxiosResponse } from 'axios';
19
+ import axiosRetry from "axios-retry";
20
+
21
+ /**
22
+ *
23
+ * @export
24
+ */
25
+ export const DUMMY_BASE_URL = 'https://example.com'
26
+
27
+ /**
28
+ *
29
+ * @throws {RequiredError}
30
+ * @export
31
+ */
32
+ export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
33
+ if (paramValue === null || paramValue === undefined) {
34
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
35
+ }
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @export
41
+ */
42
+ export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
43
+ if (configuration && configuration.apiKey) {
44
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
45
+ ? await configuration.apiKey(keyParamName)
46
+ : await configuration.apiKey;
47
+ object[keyParamName] = localVarApiKeyValue;
48
+ }
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @export
54
+ */
55
+ export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
56
+ if (configuration && (configuration.username || configuration.password)) {
57
+ object["auth"] = { username: configuration.username, password: configuration.password };
58
+ }
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ */
65
+ export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
66
+ if (configuration && configuration.accessToken) {
67
+ const accessToken = typeof configuration.accessToken === 'function'
68
+ ? await configuration.accessToken()
69
+ : await configuration.accessToken;
70
+ object["Authorization"] = "Bearer " + accessToken;
71
+ }
72
+ }
73
+
74
+ /**
75
+ *
76
+ * @export
77
+ */
78
+ export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
79
+ if (configuration && configuration.accessToken) {
80
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
81
+ ? await configuration.accessToken(name, scopes)
82
+ : await configuration.accessToken;
83
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
84
+ }
85
+ }
86
+
87
+ /**
88
+ *
89
+ * @export
90
+ */
91
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
92
+ const searchParams = new URLSearchParams(url.search);
93
+ for (const object of objects) {
94
+ for (const key in object) {
95
+ if (Array.isArray(object[key])) {
96
+ searchParams.delete(key);
97
+ for (const item of object[key]) {
98
+ searchParams.append(key, item);
99
+ }
100
+ } else {
101
+ searchParams.set(key, object[key]);
102
+ }
103
+ }
104
+ }
105
+ url.search = searchParams.toString();
106
+ }
107
+
108
+ /**
109
+ *
110
+ * @export
111
+ */
112
+ export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
113
+ const nonString = typeof value !== 'string';
114
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
115
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
116
+ : nonString;
117
+ return needsSerialization
118
+ ? JSON.stringify(value !== undefined ? value : {})
119
+ : (value || "");
120
+ }
121
+
122
+ /**
123
+ *
124
+ * @export
125
+ */
126
+ export const toPathString = function (url: URL) {
127
+ return url.pathname + url.search + url.hash
128
+ }
129
+
130
+ /**
131
+ *
132
+ * @export
133
+ */
134
+ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
135
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
136
+ axiosRetry(globalAxios, configuration.retriesConfig)
137
+ axiosArgs.axiosOptions.headers['X-SailPoint-SDK'] = 'typescript-1.0.1'
138
+ const axiosRequestArgs = {...axiosArgs.axiosOptions, url: (configuration?.basePathCC || basePath) + axiosArgs.url};
139
+ return axios.request<T, R>(axiosRequestArgs);
140
+ };
141
+ }
@@ -0,0 +1,101 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * IdentityNow cc (private) APIs
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ export interface ConfigurationParameters {
17
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
18
+ username?: string;
19
+ password?: string;
20
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
21
+ basePath?: string;
22
+ baseOptions?: any;
23
+ formDataCtor?: new () => any;
24
+ }
25
+
26
+ export class Configuration {
27
+ /**
28
+ * parameter for apiKey security
29
+ * @param name security name
30
+ * @memberof Configuration
31
+ */
32
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
33
+ /**
34
+ * parameter for basic security
35
+ *
36
+ * @type {string}
37
+ * @memberof Configuration
38
+ */
39
+ username?: string;
40
+ /**
41
+ * parameter for basic security
42
+ *
43
+ * @type {string}
44
+ * @memberof Configuration
45
+ */
46
+ password?: string;
47
+ /**
48
+ * parameter for oauth2 security
49
+ * @param name security name
50
+ * @param scopes oauth2 scope
51
+ * @memberof Configuration
52
+ */
53
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
54
+ /**
55
+ * override base path
56
+ *
57
+ * @type {string}
58
+ * @memberof Configuration
59
+ */
60
+ basePath?: string;
61
+ /**
62
+ * base options for axios calls
63
+ *
64
+ * @type {any}
65
+ * @memberof Configuration
66
+ */
67
+ baseOptions?: any;
68
+ /**
69
+ * The FormData constructor that will be used to create multipart form data
70
+ * requests. You can inject this here so that execution environments that
71
+ * do not support the FormData class can still run the generated client.
72
+ *
73
+ * @type {new () => FormData}
74
+ */
75
+ formDataCtor?: new () => any;
76
+
77
+ constructor(param: ConfigurationParameters = {}) {
78
+ this.apiKey = param.apiKey;
79
+ this.username = param.username;
80
+ this.password = param.password;
81
+ this.accessToken = param.accessToken;
82
+ this.basePath = param.basePath;
83
+ this.baseOptions = param.baseOptions;
84
+ this.formDataCtor = param.formDataCtor;
85
+ }
86
+
87
+ /**
88
+ * Check if the given MIME is a JSON MIME.
89
+ * JSON MIME examples:
90
+ * application/json
91
+ * application/json; charset=UTF8
92
+ * APPLICATION/JSON
93
+ * application/vnd.company+json
94
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
95
+ * @return True if the given MIME is JSON, false otherwise.
96
+ */
97
+ public isJsonMime(mime: string): boolean {
98
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
99
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
100
+ }
101
+ }
package/cc/git_push.sh ADDED
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="github.com"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="GIT_USER_ID"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="GIT_REPO_ID"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="Minor update"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'
package/cc/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * IdentityNow cc (private) APIs
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ export * from "./api";
17
+
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "sailpoint-sdk",
3
+ "version": "1.0.1",
4
+ "description": "OpenAPI client for sailpoint-sdk",
5
+ "author": "OpenAPI-Generator Contributors",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
9
+ },
10
+ "keywords": [
11
+ "axios",
12
+ "typescript",
13
+ "openapi-client",
14
+ "openapi-generator",
15
+ "sailpoint-sdk"
16
+ ],
17
+ "license": "Unlicense",
18
+ "main": "./dist/index.js",
19
+ "typings": "./dist/index.d.ts",
20
+ "scripts": {
21
+ "build": "tsc --outDir dist/",
22
+ "prepare": "npm run build"
23
+ },
24
+ "dependencies": {
25
+ "axios": "^0.26.1",
26
+ "axios-retry": "^3.4.0"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^12.11.5",
30
+ "typescript": "^4.0"
31
+ },
32
+ "publishConfig": {
33
+ "registry": "sailpoint.com"
34
+ }
35
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": true,
4
+ "target": "ES5",
5
+ "module": "CommonJS",
6
+ "noImplicitAny": true,
7
+ "outDir": "dist",
8
+ "rootDir": ".",
9
+ "lib": [
10
+ "es6",
11
+ "dom"
12
+ ],
13
+ "typeRoots": [
14
+ "node_modules/@types"
15
+ ]
16
+ },
17
+ "exclude": [
18
+ "dist",
19
+ "node_modules"
20
+ ]
21
+ }
@@ -0,0 +1,217 @@
1
+ import axios from "axios";
2
+ import * as os from 'os';
3
+ import * as path from 'path';
4
+ import * as yaml from "js-yaml";
5
+ import * as fs from "fs";
6
+ import { IAxiosRetryConfig } from "axios-retry";
7
+
8
+ export interface ConfigurationParameters {
9
+ baseurl?: string;
10
+ clientId?: string;
11
+ clientSecret?: string;
12
+ accessToken?: string;
13
+ tokenUrl?: string;
14
+ }
15
+
16
+ export interface Configuration {
17
+ activeenvironment?: string;
18
+ authtype?: string;
19
+ customexporttemplatespath?: string;
20
+ customsearchtemplatespath?: string;
21
+ debug?: boolean;
22
+ environments?: {[key: string]: Environment};
23
+ }
24
+
25
+ export interface Environment {
26
+ baseurl: string;
27
+ pat: Pat;
28
+ tenanturl: string;
29
+ }
30
+
31
+ export interface Pat {
32
+ clientid: string;
33
+ clientsecret: string;
34
+ }
35
+
36
+ export class Configuration {
37
+
38
+ /**
39
+ * parameter for apiKey security
40
+ * @param name security name
41
+ * @memberof Configuration
42
+ */
43
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
44
+
45
+ /**
46
+ * parameter for clientId
47
+ *
48
+ * @type {string}
49
+ * @memberof Configuration
50
+ */
51
+ clientId?: string;
52
+ /**
53
+ * parameter for clientSecret
54
+ *
55
+ * @type {string}
56
+ * @memberof Configuration
57
+ */
58
+ clientSecret?: string;
59
+ /**
60
+ * parameter for clientSecret
61
+ *
62
+ * @type {string}
63
+ * @memberof Configuration
64
+ */
65
+ /**
66
+ * parameter for oauth2 security
67
+ * @param name security name
68
+ * @param scopes oauth2 scope
69
+ * @memberof Configuration
70
+ */
71
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
72
+
73
+ /**
74
+ * parameter for clientId
75
+ *
76
+ * @type {string}
77
+ * @memberof Configuration
78
+ */
79
+ tokenUrl?: string;
80
+ /**
81
+ * parameter for basic security
82
+ *
83
+ * @type {string}
84
+ * @memberof Configuration
85
+ */
86
+ username?: string;
87
+ /**
88
+ * parameter for basic security
89
+ *
90
+ * @type {string}
91
+ * @memberof Configuration
92
+ */
93
+ password?: string;
94
+ /**
95
+ * override base path
96
+ *
97
+ * @type {string}
98
+ * @memberof Configuration
99
+ */
100
+ basePathBeta?: string;
101
+ /**
102
+ * override base path
103
+ *
104
+ * @type {string}
105
+ * @memberof Configuration
106
+ */
107
+ basePathV3?: string;
108
+ /**
109
+ * override base path
110
+ *
111
+ * @type {string}
112
+ * @memberof Configuration
113
+ */
114
+ basePathV2?: string;
115
+ /**
116
+ * override base path
117
+ *
118
+ * @type {string}
119
+ * @memberof Configuration
120
+ */
121
+ basePathCC?: string;
122
+ /**
123
+ * base options for axios calls
124
+ *
125
+ * @type {any}
126
+ * @memberof Configuration
127
+ */
128
+ baseOptions?: any;
129
+ /**
130
+ * The FormData constructor that will be used to create multipart form data
131
+ * requests. You can inject this here so that execution environments that
132
+ * do not support the FormData class can still run the generated client.
133
+ *
134
+ * @type {new () => FormData}
135
+ */
136
+ formDataCtor?: new () => any;
137
+ /**
138
+ * axios retry configuration
139
+ *
140
+ * @type {IAxiosRetryConfig}
141
+ * @memberof Configuration
142
+ */
143
+ retriesConfig?: IAxiosRetryConfig
144
+
145
+ constructor(param?: ConfigurationParameters) {
146
+
147
+ if (!param) {
148
+ param = this.getParams()
149
+ }
150
+
151
+ this.basePathBeta = param.baseurl + `/beta`
152
+ this.basePathV3 = param.baseurl + `/v3`
153
+ this.basePathV2 = param.baseurl + `/v2`
154
+ this.basePathCC = param.baseurl
155
+ this.tokenUrl = param.tokenUrl
156
+ this.clientId = param.clientId;
157
+ this.clientSecret = param.clientSecret;
158
+ const url = `${this.tokenUrl}?grant_type=client_credentials&client_id=${this.clientId}&client_secret=${this.clientSecret}`;
159
+ if (!this.accessToken) {
160
+ this.accessToken = this.getAccessToken(url);
161
+ }
162
+
163
+ }
164
+
165
+ private getParams(): ConfigurationParameters {
166
+ const config: ConfigurationParameters = {}
167
+ try {
168
+ const homeDir = os.homedir()
169
+ const configPath = path.join(homeDir, '.sailpoint','config.yaml')
170
+ const doc = yaml.load(fs.readFileSync(configPath, 'utf8')) as Configuration
171
+ if (doc.authtype && doc.authtype.toLowerCase() === 'pat') {
172
+ config.baseurl = doc.environments[doc.activeenvironment].baseurl
173
+ config.clientId = doc.environments[doc.activeenvironment].pat.clientid
174
+ config.clientSecret = doc.environments[doc.activeenvironment].pat.clientsecret
175
+ }
176
+ } catch (error) {
177
+ console.log('unable to find config file')
178
+ }
179
+ config.baseurl = process.env["SAIL_BASE_URL"] ? process.env["BASE_URL"] : config.baseurl
180
+ config.clientId = process.env["SAIL_CLIENT_ID"] ? process.env["CLIENT_ID"] : config.clientId
181
+ config.clientSecret = process.env["SAIL_CLIENT_SECRET"] ? process.env["CLIENT_SECRET"] : config.clientSecret
182
+
183
+ config.tokenUrl = config.baseurl + '/oauth/token'
184
+
185
+ return config
186
+ }
187
+
188
+ private async getAccessToken(url: string): Promise<string> {
189
+ try {
190
+ const {data, status} = await axios.post(url)
191
+ if (status === 200) {
192
+ return data.access_token;
193
+ } else {
194
+ throw new Error("Unauthorized")
195
+ }
196
+ } catch (error) {
197
+ console.error("Unable to fetch access token. Aborting.");
198
+ throw new Error(error);
199
+ }
200
+ }
201
+
202
+
203
+ /**
204
+ * Check if the given MIME is a JSON MIME.
205
+ * JSON MIME examples:
206
+ * application/json
207
+ * application/json; charset=UTF8
208
+ * APPLICATION/JSON
209
+ * application/vnd.company+json
210
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
211
+ * @return True if the given MIME is JSON, false otherwise.
212
+ */
213
+ public isJsonMime(mime: string): boolean {
214
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
215
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
216
+ }
217
+ }