@adobe/aio-cli-plugin-api-mesh 3.9.4 → 4.0.0-beta
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/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/api-mesh/__tests__/create.test.js +5 -250
- package/src/commands/api-mesh/__tests__/delete.test.js +2 -88
- package/src/commands/api-mesh/__tests__/describe.test.js +5 -69
- package/src/commands/api-mesh/__tests__/status.test.js +97 -0
- package/src/commands/api-mesh/create.js +7 -43
- package/src/commands/api-mesh/delete.js +1 -25
- package/src/commands/api-mesh/describe.js +4 -31
- package/src/commands/api-mesh/status.js +69 -82
- package/src/constants.js +3 -5
- package/src/lib/devConsole.js +6 -50
- package/src/urlBuilder.js +6 -39
|
@@ -169,10 +169,6 @@ describe('delete command tests', () => {
|
|
|
169
169
|
"Successfully deleted mesh %s",
|
|
170
170
|
"mesh_id",
|
|
171
171
|
],
|
|
172
|
-
[
|
|
173
|
-
"Successfully unsubscribed API Key %s",
|
|
174
|
-
"dummy_client_id",
|
|
175
|
-
],
|
|
176
172
|
]
|
|
177
173
|
`);
|
|
178
174
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
@@ -204,67 +200,7 @@ describe('delete command tests', () => {
|
|
|
204
200
|
`);
|
|
205
201
|
});
|
|
206
202
|
|
|
207
|
-
test('should delete mesh
|
|
208
|
-
getApiKeyCredential.mockRejectedValueOnce(new Error('unable to get api key'));
|
|
209
|
-
|
|
210
|
-
const runResult = DeleteCommand.run();
|
|
211
|
-
|
|
212
|
-
await expect(runResult).rejects.toEqual(
|
|
213
|
-
new Error(
|
|
214
|
-
'Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id',
|
|
215
|
-
),
|
|
216
|
-
);
|
|
217
|
-
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
218
|
-
[
|
|
219
|
-
[
|
|
220
|
-
"Successfully deleted mesh %s",
|
|
221
|
-
"mesh_id",
|
|
222
|
-
],
|
|
223
|
-
[
|
|
224
|
-
"unable to get api key",
|
|
225
|
-
],
|
|
226
|
-
]
|
|
227
|
-
`);
|
|
228
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
229
|
-
[
|
|
230
|
-
[
|
|
231
|
-
"Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
232
|
-
],
|
|
233
|
-
]
|
|
234
|
-
`);
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
test('should delete mesh but fail to unsubscribe if unsubscribe api failed', async () => {
|
|
238
|
-
unsubscribeCredentialFromMeshService.mockRejectedValueOnce(new Error('unsubscribe api failed'));
|
|
239
|
-
|
|
240
|
-
const runResult = DeleteCommand.run();
|
|
241
|
-
|
|
242
|
-
await expect(runResult).rejects.toEqual(
|
|
243
|
-
new Error(
|
|
244
|
-
'Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id',
|
|
245
|
-
),
|
|
246
|
-
);
|
|
247
|
-
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
248
|
-
[
|
|
249
|
-
[
|
|
250
|
-
"Successfully deleted mesh %s",
|
|
251
|
-
"mesh_id",
|
|
252
|
-
],
|
|
253
|
-
[
|
|
254
|
-
"unsubscribe api failed",
|
|
255
|
-
],
|
|
256
|
-
]
|
|
257
|
-
`);
|
|
258
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
259
|
-
[
|
|
260
|
-
[
|
|
261
|
-
"Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
262
|
-
],
|
|
263
|
-
]
|
|
264
|
-
`);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
test('should delete mesh and unsubscribe if correct args are provided', async () => {
|
|
203
|
+
test('should delete mesh if correct args are provided', async () => {
|
|
268
204
|
const runResult = await DeleteCommand.run();
|
|
269
205
|
|
|
270
206
|
expect(initRequestId).toHaveBeenCalled();
|
|
@@ -283,35 +219,13 @@ describe('delete command tests', () => {
|
|
|
283
219
|
],
|
|
284
220
|
]
|
|
285
221
|
`);
|
|
286
|
-
|
|
287
|
-
[
|
|
288
|
-
[
|
|
289
|
-
"1234",
|
|
290
|
-
"5678",
|
|
291
|
-
"123456789",
|
|
292
|
-
],
|
|
293
|
-
]
|
|
294
|
-
`);
|
|
295
|
-
expect(unsubscribeCredentialFromMeshService.mock.calls).toMatchInlineSnapshot(`
|
|
296
|
-
[
|
|
297
|
-
[
|
|
298
|
-
"1234",
|
|
299
|
-
"5678",
|
|
300
|
-
"123456789",
|
|
301
|
-
"dummy_integration_id",
|
|
302
|
-
],
|
|
303
|
-
]
|
|
304
|
-
`);
|
|
222
|
+
|
|
305
223
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
306
224
|
[
|
|
307
225
|
[
|
|
308
226
|
"Successfully deleted mesh %s",
|
|
309
227
|
"mesh_id",
|
|
310
228
|
],
|
|
311
|
-
[
|
|
312
|
-
"Successfully unsubscribed API Key %s",
|
|
313
|
-
"dummy_client_id",
|
|
314
|
-
],
|
|
315
229
|
]
|
|
316
230
|
`);
|
|
317
231
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
@@ -186,27 +186,9 @@ describe('describe command tests', () => {
|
|
|
186
186
|
"dummy_meshId",
|
|
187
187
|
],
|
|
188
188
|
[
|
|
189
|
-
"
|
|
190
|
-
API Mesh now runs at the edge and legacy mesh URLs will be deprecated.
|
|
191
|
-
Use the following link to find more information on how to migrate your mesh:",
|
|
192
|
-
],
|
|
193
|
-
[
|
|
194
|
-
"https://developer.adobe.com/graphql-mesh-gateway/mesh/release/migration
|
|
195
|
-
",
|
|
196
|
-
],
|
|
197
|
-
[
|
|
198
|
-
"Legacy Mesh Endpoint: %s",
|
|
199
|
-
"https://graph.adobe.io/api/dummy_meshId/graphql",
|
|
200
|
-
],
|
|
201
|
-
[
|
|
202
|
-
"Edge Mesh Endpoint: %s
|
|
203
|
-
",
|
|
189
|
+
"Mesh Endpoint: %s",
|
|
204
190
|
"https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
|
|
205
191
|
],
|
|
206
|
-
[
|
|
207
|
-
"Update your mesh before using the edge mesh endpoint.
|
|
208
|
-
You can validate your edge mesh status using the aio api-mesh status command.",
|
|
209
|
-
],
|
|
210
192
|
]
|
|
211
193
|
`);
|
|
212
194
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
@@ -251,27 +233,9 @@ describe('describe command tests', () => {
|
|
|
251
233
|
"dummy_meshId",
|
|
252
234
|
],
|
|
253
235
|
[
|
|
254
|
-
"
|
|
255
|
-
API Mesh now runs at the edge and legacy mesh URLs will be deprecated.
|
|
256
|
-
Use the following link to find more information on how to migrate your mesh:",
|
|
257
|
-
],
|
|
258
|
-
[
|
|
259
|
-
"https://developer.adobe.com/graphql-mesh-gateway/mesh/release/migration
|
|
260
|
-
",
|
|
261
|
-
],
|
|
262
|
-
[
|
|
263
|
-
"Legacy Mesh Endpoint: %s",
|
|
264
|
-
"https://graph.adobe.io/api/dummy_meshId/graphql?api_key=dummy_apiKey",
|
|
265
|
-
],
|
|
266
|
-
[
|
|
267
|
-
"Edge Mesh Endpoint: %s
|
|
268
|
-
",
|
|
236
|
+
"Mesh Endpoint: %s",
|
|
269
237
|
"https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
|
|
270
238
|
],
|
|
271
|
-
[
|
|
272
|
-
"Update your mesh before using the edge mesh endpoint.
|
|
273
|
-
You can validate your edge mesh status using the aio api-mesh status command.",
|
|
274
|
-
],
|
|
275
239
|
]
|
|
276
240
|
`);
|
|
277
241
|
});
|
|
@@ -320,27 +284,9 @@ describe('describe command tests', () => {
|
|
|
320
284
|
"dummy_meshId",
|
|
321
285
|
],
|
|
322
286
|
[
|
|
323
|
-
"
|
|
324
|
-
API Mesh now runs at the edge and legacy mesh URLs will be deprecated.
|
|
325
|
-
Use the following link to find more information on how to migrate your mesh:",
|
|
326
|
-
],
|
|
327
|
-
[
|
|
328
|
-
"https://developer.adobe.com/graphql-mesh-gateway/mesh/release/migration
|
|
329
|
-
",
|
|
330
|
-
],
|
|
331
|
-
[
|
|
332
|
-
"Legacy Mesh Endpoint: %s",
|
|
333
|
-
"https://tigraph.adobe.io/dummy_meshId/graphql",
|
|
334
|
-
],
|
|
335
|
-
[
|
|
336
|
-
"Edge Mesh Endpoint: %s
|
|
337
|
-
",
|
|
287
|
+
"Mesh Endpoint: %s",
|
|
338
288
|
"https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
|
|
339
289
|
],
|
|
340
|
-
[
|
|
341
|
-
"Update your mesh before using the edge mesh endpoint.
|
|
342
|
-
You can validate your edge mesh status using the aio api-mesh status command.",
|
|
343
|
-
],
|
|
344
290
|
]
|
|
345
291
|
`);
|
|
346
292
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
@@ -361,12 +307,7 @@ describe('describe command tests', () => {
|
|
|
361
307
|
await DescribeCommand.run();
|
|
362
308
|
|
|
363
309
|
expect(logSpy).toHaveBeenCalledWith(
|
|
364
|
-
expect.stringContaining('
|
|
365
|
-
'https://graph.adobe.io/api/dummy_meshId/graphql?api_key=dummy_apiKey',
|
|
366
|
-
);
|
|
367
|
-
|
|
368
|
-
expect(logSpy).toHaveBeenCalledWith(
|
|
369
|
-
expect.stringContaining('Edge Mesh Endpoint:'),
|
|
310
|
+
expect.stringContaining('Mesh Endpoint:'),
|
|
370
311
|
'https://edge-graph.adobe.io/api/dummy_meshId/graphql',
|
|
371
312
|
);
|
|
372
313
|
});
|
|
@@ -386,12 +327,7 @@ describe('describe command tests', () => {
|
|
|
386
327
|
await DescribeCommand.run();
|
|
387
328
|
|
|
388
329
|
expect(logSpy).toHaveBeenCalledWith(
|
|
389
|
-
expect.stringContaining('
|
|
390
|
-
'https://graph.adobe.io/api/dummy_meshId/graphql?api_key=dummy_apiKey',
|
|
391
|
-
);
|
|
392
|
-
|
|
393
|
-
expect(logSpy).toHaveBeenCalledWith(
|
|
394
|
-
expect.stringContaining('Edge Mesh Endpoint:'),
|
|
330
|
+
expect.stringContaining('Mesh Endpoint:'),
|
|
395
331
|
'https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql',
|
|
396
332
|
);
|
|
397
333
|
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const StatusCommand = require('../status');
|
|
2
|
+
|
|
3
|
+
// Initialize mock values
|
|
4
|
+
const mockOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };
|
|
5
|
+
const mockProject = { id: '5678', title: 'Project01' };
|
|
6
|
+
const mockWorkspace = { id: '123456789', title: 'Workspace01' };
|
|
7
|
+
const mockMeshId = '00000000-0000-0000-0000-000000000000';
|
|
8
|
+
global.requestId = 'dummy_request_id';
|
|
9
|
+
|
|
10
|
+
// Create mock modules and functions
|
|
11
|
+
jest.mock('../../../lib/devConsole');
|
|
12
|
+
jest.mock('../../../helpers');
|
|
13
|
+
const parseSpy = jest.spyOn(StatusCommand.prototype, 'parse');
|
|
14
|
+
const logSpy = jest.spyOn(StatusCommand.prototype, 'log');
|
|
15
|
+
const errorLogSpy = jest.spyOn(StatusCommand.prototype, 'error');
|
|
16
|
+
|
|
17
|
+
// Prepare mocks
|
|
18
|
+
const { initSdk } = require('../../../helpers');
|
|
19
|
+
const { getMeshId, getMesh, getMeshDeployments } = require('../../../lib/devConsole');
|
|
20
|
+
initSdk.mockResolvedValue({
|
|
21
|
+
imsOrgId: mockOrg.id,
|
|
22
|
+
imsOrgCode: mockOrg.code,
|
|
23
|
+
projectId: mockProject.id,
|
|
24
|
+
workspaceId: mockWorkspace.id,
|
|
25
|
+
workspaceName: mockWorkspace.title,
|
|
26
|
+
orgName: mockOrg.name,
|
|
27
|
+
projectName: mockProject.title,
|
|
28
|
+
});
|
|
29
|
+
parseSpy.mockResolvedValue({
|
|
30
|
+
flags: {},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('status command tests', () => {
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
jest.clearAllMocks();
|
|
36
|
+
getMeshId.mockResolvedValue(mockMeshId);
|
|
37
|
+
getMesh.mockResolvedValue({ meshStatus: null });
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('use mesh build status', () => {
|
|
41
|
+
test.each([
|
|
42
|
+
['pending', 'Mesh is awaiting processing.'],
|
|
43
|
+
['building', 'Mesh is currently building. Wait a few minutes before checking again.'],
|
|
44
|
+
['error', 'Mesh build has errors.'],
|
|
45
|
+
['not-a-real-status', 'Mesh status is not available. Wait a few minutes and try again.'],
|
|
46
|
+
[null, 'Mesh status is not available. Wait a few minutes and try again.'],
|
|
47
|
+
])(
|
|
48
|
+
'should output correct message when mesh build status is "%s"',
|
|
49
|
+
async (meshBuildStatus, expectedMessage) => {
|
|
50
|
+
getMesh.mockResolvedValue({ meshStatus: meshBuildStatus });
|
|
51
|
+
await StatusCommand.run();
|
|
52
|
+
expect(logSpy).toHaveBeenCalledWith(expectedMessage);
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('use mesh deployment status', () => {
|
|
58
|
+
beforeEach(() => {
|
|
59
|
+
getMesh.mockResolvedValue({ meshStatus: 'success' });
|
|
60
|
+
getMeshDeployments.mockResolvedValue({
|
|
61
|
+
status: null,
|
|
62
|
+
meshId: mockMeshId,
|
|
63
|
+
error: null,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test.each([
|
|
68
|
+
['provisioning', 'Currently provisioning your mesh. Wait a few minutes and try again.'],
|
|
69
|
+
['de-provisioning', 'Currently de-provisioning your mesh. Wait a few minutes and try again.'],
|
|
70
|
+
['success', 'Mesh was built successfully.'],
|
|
71
|
+
['error', 'Mesh build has errors.'],
|
|
72
|
+
['not-a-real-status', 'Mesh status is not available. Wait a few minutes and try again.'],
|
|
73
|
+
[null, 'Mesh status is not available. Wait a few minutes and try again.'],
|
|
74
|
+
])(
|
|
75
|
+
'should output correct message when mesh deployment status is "%s"',
|
|
76
|
+
async (meshDeployStatus, expectedMessage) => {
|
|
77
|
+
getMeshDeployments.mockResolvedValue({
|
|
78
|
+
status: meshDeployStatus,
|
|
79
|
+
meshId: mockMeshId,
|
|
80
|
+
error: null,
|
|
81
|
+
});
|
|
82
|
+
await StatusCommand.run();
|
|
83
|
+
expect(logSpy).toHaveBeenCalledWith(expectedMessage);
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('unexpected error', () => {
|
|
89
|
+
test('should output mesh not found error when mesh does not exist', async () => {
|
|
90
|
+
getMeshId.mockResolvedValue(null);
|
|
91
|
+
const expectedMessage = `Unable to get mesh status. No mesh found for Org(${mockOrg.id}) -> Project(${mockProject.id}) -> Workspace(${mockWorkspace.id}). Please check the details and try again.`;
|
|
92
|
+
const runResult = StatusCommand.run();
|
|
93
|
+
await expect(runResult).rejects.toEqual(new Error(expectedMessage));
|
|
94
|
+
expect(errorLogSpy).toHaveBeenCalledWith(expectedMessage);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -10,7 +10,6 @@ governing permissions and limitations under the License.
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const { Command } = require('@oclif/core');
|
|
13
|
-
const chalk = require('chalk');
|
|
14
13
|
const { initSdk, initRequestId, promptConfirm, importFiles } = require('../../helpers');
|
|
15
14
|
const logger = require('../../classes/logger');
|
|
16
15
|
const {
|
|
@@ -28,7 +27,7 @@ const {
|
|
|
28
27
|
encryptSecrets,
|
|
29
28
|
} = require('../../utils');
|
|
30
29
|
const { createMesh, getPublicEncryptionKey } = require('../../lib/devConsole');
|
|
31
|
-
const {
|
|
30
|
+
const { buildMeshUrl } = require('../../urlBuilder');
|
|
32
31
|
|
|
33
32
|
class CreateCommand extends Command {
|
|
34
33
|
static args = [{ name: 'file' }];
|
|
@@ -131,7 +130,7 @@ class CreateCommand extends Command {
|
|
|
131
130
|
|
|
132
131
|
if (shouldContinue) {
|
|
133
132
|
try {
|
|
134
|
-
const { mesh
|
|
133
|
+
const { mesh } = await createMesh(
|
|
135
134
|
imsOrgId,
|
|
136
135
|
projectId,
|
|
137
136
|
workspaceId,
|
|
@@ -155,47 +154,12 @@ class CreateCommand extends Command {
|
|
|
155
154
|
'******************************************************************************************************',
|
|
156
155
|
);
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (sdkList) {
|
|
162
|
-
this.log('Successfully subscribed API Key %s to API Mesh service', apiKey);
|
|
163
|
-
|
|
164
|
-
const meshUrl = await buildMeshUrl(
|
|
165
|
-
imsOrgId,
|
|
166
|
-
projectId,
|
|
167
|
-
workspaceId,
|
|
168
|
-
workspaceName,
|
|
169
|
-
mesh.meshId,
|
|
170
|
-
apiKey,
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
const edgeMeshUrl = buildEdgeMeshUrl(mesh.meshId, workspaceName);
|
|
174
|
-
this.log(
|
|
175
|
-
chalk.bgYellow(
|
|
176
|
-
`\nAPI Mesh now runs at the edge and legacy mesh URLs will be deprecated.\nUse the following link to find more information on how to migrate your mesh:`,
|
|
177
|
-
),
|
|
178
|
-
);
|
|
179
|
-
this.log(
|
|
180
|
-
chalk.underline.blue(
|
|
181
|
-
'https://developer.adobe.com/graphql-mesh-gateway/mesh/release/migration\n',
|
|
182
|
-
),
|
|
183
|
-
);
|
|
184
|
-
this.log('Legacy Mesh Endpoint: %s', meshUrl);
|
|
185
|
-
this.log(chalk.bold('Edge Mesh Endpoint: %s\n'), edgeMeshUrl);
|
|
186
|
-
} else {
|
|
187
|
-
this.log('Unable to subscribe API Key %s to API Mesh service', apiKey);
|
|
188
|
-
}
|
|
189
|
-
} else {
|
|
190
|
-
this.log('Unable to create API Key');
|
|
191
|
-
}
|
|
157
|
+
const meshUrl = buildMeshUrl(mesh.meshId, workspaceName);
|
|
158
|
+
this.log('Mesh Endpoint: %s', meshUrl);
|
|
159
|
+
|
|
192
160
|
// When renaming the return values, make sure to make necessary changes to
|
|
193
|
-
// template adobe/generator-app-api-mesh since it relies on "mesh"
|
|
194
|
-
return {
|
|
195
|
-
apiKey,
|
|
196
|
-
sdkList,
|
|
197
|
-
mesh,
|
|
198
|
-
};
|
|
161
|
+
// template adobe/generator-app-api-mesh since it relies on "mesh"
|
|
162
|
+
return { mesh };
|
|
199
163
|
} else {
|
|
200
164
|
this.error(`Unable to create a mesh. Please try again. RequestId: ${global.requestId}`, {
|
|
201
165
|
exit: false,
|
|
@@ -14,12 +14,7 @@ const { Command } = require('@oclif/command');
|
|
|
14
14
|
const logger = require('../../classes/logger');
|
|
15
15
|
const { initSdk, initRequestId, promptConfirm } = require('../../helpers');
|
|
16
16
|
const { ignoreCacheFlag, autoConfirmActionFlag } = require('../../utils');
|
|
17
|
-
const {
|
|
18
|
-
getMeshId,
|
|
19
|
-
deleteMesh,
|
|
20
|
-
getApiKeyCredential,
|
|
21
|
-
unsubscribeCredentialFromMeshService,
|
|
22
|
-
} = require('../../lib/devConsole');
|
|
17
|
+
const { getMeshId, deleteMesh } = require('../../lib/devConsole');
|
|
23
18
|
|
|
24
19
|
require('dotenv').config();
|
|
25
20
|
|
|
@@ -69,25 +64,6 @@ class DeleteCommand extends Command {
|
|
|
69
64
|
if (deleteMeshResponse) {
|
|
70
65
|
this.log('Successfully deleted mesh %s', meshId);
|
|
71
66
|
|
|
72
|
-
const credential = await getApiKeyCredential(imsOrgId, projectId, workspaceId);
|
|
73
|
-
|
|
74
|
-
if (credential) {
|
|
75
|
-
const newSDKList = await unsubscribeCredentialFromMeshService(
|
|
76
|
-
imsOrgId,
|
|
77
|
-
projectId,
|
|
78
|
-
workspaceId,
|
|
79
|
-
credential.id_integration,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
if (newSDKList) {
|
|
83
|
-
this.log('Successfully unsubscribed API Key %s', credential.client_id);
|
|
84
|
-
} else {
|
|
85
|
-
this.log('Unable to unsubscribe API Key %s', credential.client_id);
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
this.log('No API Key found to unsubscribe');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
67
|
return deleteMeshResponse;
|
|
92
68
|
} else {
|
|
93
69
|
throw new Error('Unable to delete mesh');
|
|
@@ -10,13 +10,11 @@ governing permissions and limitations under the License.
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const { Command } = require('@oclif/command');
|
|
13
|
-
const chalk = require('chalk');
|
|
14
|
-
|
|
15
13
|
const logger = require('../../classes/logger');
|
|
16
14
|
const { initSdk, initRequestId } = require('../../helpers');
|
|
17
15
|
const { ignoreCacheFlag } = require('../../utils');
|
|
18
16
|
const { describeMesh } = require('../../lib/devConsole');
|
|
19
|
-
const { buildMeshUrl
|
|
17
|
+
const { buildMeshUrl } = require('../../urlBuilder');
|
|
20
18
|
|
|
21
19
|
require('dotenv').config();
|
|
22
20
|
|
|
@@ -40,42 +38,17 @@ class DescribeCommand extends Command {
|
|
|
40
38
|
const meshDetails = await describeMesh(imsOrgId, projectId, workspaceId, workspaceName);
|
|
41
39
|
|
|
42
40
|
if (meshDetails) {
|
|
43
|
-
const { meshId
|
|
41
|
+
const { meshId } = meshDetails;
|
|
44
42
|
|
|
45
43
|
if (meshId) {
|
|
46
|
-
const meshUrl =
|
|
47
|
-
imsOrgId,
|
|
48
|
-
projectId,
|
|
49
|
-
workspaceId,
|
|
50
|
-
workspaceName,
|
|
51
|
-
meshId,
|
|
52
|
-
apiKey,
|
|
53
|
-
);
|
|
54
|
-
|
|
44
|
+
const meshUrl = buildMeshUrl(meshId, workspaceName);
|
|
55
45
|
this.log('Successfully retrieved mesh details \n');
|
|
56
46
|
this.log('Org ID: %s', imsOrgId);
|
|
57
47
|
this.log('Project ID: %s', projectId);
|
|
58
48
|
this.log('Workspace ID: %s', workspaceId);
|
|
59
49
|
this.log('Mesh ID: %s', meshId);
|
|
50
|
+
this.log('Mesh Endpoint: %s', meshUrl);
|
|
60
51
|
|
|
61
|
-
const edgeMeshUrl = buildEdgeMeshUrl(meshId, workspaceName);
|
|
62
|
-
this.log(
|
|
63
|
-
chalk.bgYellow(
|
|
64
|
-
`\nAPI Mesh now runs at the edge and legacy mesh URLs will be deprecated.\nUse the following link to find more information on how to migrate your mesh:`,
|
|
65
|
-
),
|
|
66
|
-
);
|
|
67
|
-
this.log(
|
|
68
|
-
chalk.underline.blue(
|
|
69
|
-
'https://developer.adobe.com/graphql-mesh-gateway/mesh/release/migration\n',
|
|
70
|
-
),
|
|
71
|
-
);
|
|
72
|
-
this.log('Legacy Mesh Endpoint: %s', meshUrl);
|
|
73
|
-
this.log(chalk.bold('Edge Mesh Endpoint: %s\n'), edgeMeshUrl);
|
|
74
|
-
this.log(
|
|
75
|
-
chalk.bgYellow(
|
|
76
|
-
'Update your mesh before using the edge mesh endpoint.\nYou can validate your edge mesh status using the aio api-mesh status command.',
|
|
77
|
-
),
|
|
78
|
-
);
|
|
79
52
|
return meshDetails;
|
|
80
53
|
} else {
|
|
81
54
|
logger.error(
|