@skyramp/skyramp 1.2.4 → 1.2.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/skyramp",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "module for leveraging skyramp cli functionality",
5
5
  "scripts": {
6
6
  "lint": "eslint 'src/**/*.js' 'src/**/*.ts' --fix",
@@ -119,7 +119,6 @@ interface GenerateRestTestOptions {
119
119
  loadTargetRPS?: string;
120
120
  unblock?: boolean;
121
121
  entrypoint?: string;
122
- accessToken?: string;
123
122
  }
124
123
 
125
124
  interface SendScenarioOptions {
@@ -134,6 +133,8 @@ interface SendScenarioOptions {
134
133
  export declare class SkyrampClient {
135
134
  constructor(kubeconfigPath?: string, clusterName?: string, context?: string, userToken?: string);
136
135
  constructor(options: SkyrampClientOptions);
136
+ login(): Promise<string>;
137
+ logout(): Promise<string>;
137
138
  applyLocal(): Promise<void>;
138
139
  addKubeconfig(context: string, clusterName: string, kubeconfigPath: string): Promise<void>;
139
140
  removeLocal(): Promise<void>;
@@ -28,6 +28,10 @@ const WORKER_URL = "public.ecr.aws/j1n2c2p2/rampup/worker";
28
28
  const WORKER_TAG = "latest";
29
29
  const CONTAINER_PORT = 35142;
30
30
 
31
+ // auth functions
32
+ const loginWrapper = lib.func('loginWrapper', 'string', []);
33
+ const logoutWrapper = lib.func('logoutWrapper', 'string', []);
34
+
31
35
  // k8s related
32
36
  const { createTestDescriptionFromScenario, getYamlBytes, readDataFromFile, SKYRAMP_YAML_VERSION } = require('../utils');
33
37
  const applyLocalWrapper = lib.func('applyLocalWrapper', 'string', []);
@@ -51,7 +55,7 @@ const deployTargetWrapper = lib.func('deployTargetWrapper', 'string', ['string',
51
55
  const deleteTargetWrapper = lib.func('deleteTargetWrapper', 'string', ['string', 'string', 'string', 'string', 'string']);
52
56
  const runTesterGenerateRestWrapper = lib.func('runTesterGenerateRestWrapper', testerGenerateType, ['string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'int', 'bool', 'bool', 'bool']);
53
57
 
54
- const generateRestTestWrapper = lib.func('generateRestTestWrapper', 'string', ['string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'bool', 'bool', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'bool', 'string', 'bool', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'bool', 'string', 'string']);
58
+ const generateRestTestWrapper = lib.func('generateRestTestWrapper', 'string', ['string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'bool', 'bool', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'bool', 'string', 'bool', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'bool', 'string']);
55
59
  const traceCollectWrapper = lib.func('traceCollectWrapper', 'string', ['string', 'string', 'bool', 'string']);
56
60
  const analyzeOpenapiWrapper = lib.func('analyzeOpenapiWrapper', 'string', ['string', 'string']);
57
61
 
@@ -169,6 +173,38 @@ class SkyrampClient {
169
173
  });
170
174
  }
171
175
 
176
+ /**
177
+ * Logs in to Skyramp.
178
+ * @returns {Promise} A Promise that resolves if the login is successful, or rejects with an error if an error occurs.
179
+ */
180
+ async login() {
181
+ return new Promise((resolve, reject) => {
182
+ loginWrapper.async((err, res) => {
183
+ if (err) {
184
+ reject(err);
185
+ } else {
186
+ resolve(res);
187
+ }
188
+ });
189
+ });
190
+ }
191
+
192
+ /**
193
+ * Logs out of Skyramp.
194
+ * @returns {Promise} A Promise that resolves if the logout is successful, or rejects with an error if an error occurs.
195
+ */
196
+ async logout() {
197
+ return new Promise((resolve, reject) => {
198
+ logoutWrapper.async((err, res) => {
199
+ if (err) {
200
+ reject(err);
201
+ } else {
202
+ resolve(res);
203
+ }
204
+ });
205
+ });
206
+ }
207
+
172
208
  /**
173
209
  * Adds a Kubernetes configuration to the SkyrampClient object.
174
210
  *
@@ -782,7 +818,6 @@ class SkyrampClient {
782
818
  options.loadTargetRPS || "0",
783
819
  options.unblock || false,
784
820
  options.entrypoint || "",
785
- options.accessToken || "",
786
821
  (err, res) => {
787
822
  if (err) {
788
823
  reject(err);