@dishantlangayan/solace-cloud-cli 0.0.2 → 0.0.4

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 (30) hide show
  1. package/README.md +158 -35
  2. package/dist/commands/missionctrl/broker/create.d.ts +4 -3
  3. package/dist/commands/missionctrl/broker/create.js +12 -18
  4. package/dist/commands/missionctrl/broker/delete.d.ts +5 -3
  5. package/dist/commands/missionctrl/broker/delete.js +16 -4
  6. package/dist/commands/missionctrl/broker/display.d.ts +4 -3
  7. package/dist/commands/missionctrl/broker/display.js +12 -16
  8. package/dist/commands/missionctrl/broker/list.d.ts +4 -3
  9. package/dist/commands/missionctrl/broker/list.js +7 -4
  10. package/dist/commands/missionctrl/broker/opstatus.d.ts +15 -0
  11. package/dist/commands/missionctrl/broker/opstatus.js +159 -0
  12. package/dist/commands/missionctrl/broker/update.d.ts +15 -0
  13. package/dist/commands/missionctrl/broker/update.js +77 -0
  14. package/dist/commands/platform/env/create.d.ts +5 -4
  15. package/dist/commands/platform/env/create.js +11 -18
  16. package/dist/commands/platform/env/delete.d.ts +5 -3
  17. package/dist/commands/platform/env/delete.js +19 -7
  18. package/dist/commands/platform/env/display.d.ts +4 -3
  19. package/dist/commands/platform/env/display.js +12 -17
  20. package/dist/commands/platform/env/list.d.ts +4 -3
  21. package/dist/commands/platform/env/list.js +21 -17
  22. package/dist/commands/platform/env/update.d.ts +5 -4
  23. package/dist/commands/platform/env/update.js +14 -22
  24. package/dist/types/broker.d.ts +148 -14
  25. package/dist/util/internal.d.ts +15 -0
  26. package/dist/util/internal.js +34 -0
  27. package/dist/util/sc-connection.d.ts +1 -0
  28. package/dist/util/sc-connection.js +5 -0
  29. package/oclif.manifest.json +385 -15
  30. package/package.json +3 -1
@@ -1,8 +1,8 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { table } from 'table';
3
- import { camelCaseToTitleCase } from '../../../util/internal.js';
1
+ import { Flags } from '@oclif/core';
2
+ import { ScCommand } from '../../../sc-command.js';
3
+ import { camelCaseToTitleCase, renderKeyValueTable } from '../../../util/internal.js';
4
4
  import { ScConnection } from '../../../util/sc-connection.js';
5
- export default class PlatformEnvUpdate extends Command {
5
+ export default class PlatformEnvUpdate extends ScCommand {
6
6
  static args = {};
7
7
  static description = `Modify an environment's attributes
8
8
 
@@ -15,7 +15,7 @@ export default class PlatformEnvUpdate extends Command {
15
15
  '<%= config.bin %> <%= command.id %> --env-id=MyEnvId --new-name=MyNewEnvName --desc="My description to update" --isDefault'
16
16
  ];
17
17
  static flags = {
18
- desc: Flags.string({
18
+ description: Flags.string({
19
19
  char: 'd',
20
20
  description: 'Description of the environment to update.'
21
21
  }),
@@ -37,7 +37,7 @@ export default class PlatformEnvUpdate extends Command {
37
37
  };
38
38
  async run() {
39
39
  const { flags } = await this.parse(PlatformEnvUpdate);
40
- const desc = flags.desc ?? '';
40
+ const desc = flags.description ?? '';
41
41
  const envId = flags['env-id'] ?? '';
42
42
  const name = flags.name ?? '';
43
43
  const newName = flags['new-name'] ?? '';
@@ -50,7 +50,7 @@ export default class PlatformEnvUpdate extends Command {
50
50
  const conn = new ScConnection();
51
51
  // API url
52
52
  let apiUrl = `/platform/environments`;
53
- let envIdToUdpate = envId;
53
+ let envIdToUpdate = envId;
54
54
  // If env name provided, get the environment matching provided name and delete. If more than one environment matches, an error will be thrown.
55
55
  // If env id provided, delete environment with that id
56
56
  if (name) {
@@ -61,30 +61,22 @@ export default class PlatformEnvUpdate extends Command {
61
61
  this.error(`Multiple environments found with: ${name}. Exactly one environment must match the provided name.`);
62
62
  }
63
63
  else {
64
- envIdToUdpate = resp.data[0]?.id;
64
+ envIdToUpdate = resp.data[0]?.id;
65
65
  }
66
66
  }
67
- // API call to delete environment by id
68
- apiUrl += `/${envIdToUdpate}`;
67
+ // API call to update environment by id
68
+ apiUrl += `/${envIdToUpdate}`;
69
69
  const resp = await conn.put(apiUrl, body);
70
- this.log(`Environment with id '${envIdToUdpate}' has been updated successfully.`);
70
+ this.log(`Environment with id '${envIdToUpdate}' has been updated successfully.`);
71
71
  this.print(resp.data);
72
+ return resp.data;
72
73
  }
73
74
  print(environment) {
74
- this.log();
75
75
  const tableRows = [
76
76
  ['Key', 'Value'],
77
77
  ...Object.entries(environment).map(([key, value]) => [camelCaseToTitleCase(key), value]),
78
78
  ];
79
- // Table config
80
- const config = {
81
- columns: {
82
- 1: { width: 50, wrapWord: true },
83
- },
84
- drawHorizontalLine(lineIndex, rowCount) {
85
- return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
86
- },
87
- };
88
- this.log(table(tableRows, config));
79
+ this.log();
80
+ this.log(renderKeyValueTable(tableRows));
89
81
  }
90
82
  }
@@ -1,4 +1,11 @@
1
- export interface EventBrokerCreateDetail {
1
+ export interface ProgressLog {
2
+ message: string;
3
+ status: string;
4
+ step: string;
5
+ stepId: string;
6
+ timestamp: string;
7
+ }
8
+ export interface EventBrokerOperationDetail {
2
9
  completedTime?: string;
3
10
  createdBy?: string;
4
11
  createdTime?: string;
@@ -8,32 +15,40 @@ export interface EventBrokerCreateDetail {
8
15
  };
9
16
  id: string;
10
17
  operationType?: string;
11
- progressLogs?: {
12
- message: string;
13
- step: string;
14
- timestamp: string;
15
- }[];
18
+ progressLogs?: ProgressLog[];
16
19
  resourceId?: string;
17
20
  resourceType?: string;
18
21
  status?: string;
19
22
  type?: string;
20
23
  }
21
- export interface EventBrokerCreateApiResponse {
22
- data: EventBrokerCreateDetail;
23
- meta: {
24
+ export interface EventBrokerOperationApiResponse {
25
+ data: EventBrokerOperationDetail;
26
+ meta?: {
24
27
  additionalProp?: Record<string, unknown>;
25
28
  };
26
29
  }
27
- export interface EventBrokerDeleteListApiResponse {
28
- data: EventBrokerCreateDetail[];
29
- meta: {
30
+ export interface EventBrokerAllOperationsApiResponse {
31
+ data: EventBrokerOperationDetail[];
32
+ meta?: {
30
33
  additionalProp?: Record<string, unknown>;
31
34
  };
32
35
  }
33
36
  export interface EventBrokerListApiResponse {
34
37
  data: EventBrokerServiceDetail[];
35
- meta: {
36
- pagination: {
38
+ meta?: {
39
+ pagination?: {
40
+ count: number;
41
+ nextPage: null | string;
42
+ pageNumber: number;
43
+ pageSize: number;
44
+ totalPages: number;
45
+ };
46
+ };
47
+ }
48
+ export interface EventBrokerApiResponse {
49
+ data: EventBrokerServiceDetail;
50
+ meta?: {
51
+ pagination?: {
37
52
  count: number;
38
53
  nextPage: null | string;
39
54
  pageNumber: number;
@@ -44,17 +59,136 @@ export interface EventBrokerListApiResponse {
44
59
  }
45
60
  export interface EventBrokerServiceDetail {
46
61
  adminState?: string;
62
+ allowedActions?: string[];
63
+ broker?: {
64
+ clientCertificateAuthorities?: Array<{
65
+ name: string;
66
+ }>;
67
+ cluster?: {
68
+ backupRouterName?: string;
69
+ monitoringRouterName?: string;
70
+ name?: string;
71
+ password?: string;
72
+ primaryRouterName?: string;
73
+ remoteAddress?: string;
74
+ supportedAuthenticationMode?: string[];
75
+ };
76
+ configSyncSslEnabled?: boolean;
77
+ diskSize?: number;
78
+ domainCertificateAuthorities?: Array<{
79
+ name: string;
80
+ }>;
81
+ ldapProfiles?: Array<{
82
+ name: string;
83
+ }>;
84
+ managementReadOnlyLoginCredential?: {
85
+ password?: string;
86
+ token?: string;
87
+ username?: string;
88
+ };
89
+ maxSpoolUsage?: number;
90
+ monitoringAgentEnabled?: boolean;
91
+ monitoringMode?: string;
92
+ msgVpns?: Array<{
93
+ authenticationBasicEnabled?: boolean;
94
+ authenticationBasicType?: string;
95
+ authenticationClientCertAllowApiProvidedUsernameEnabled?: boolean;
96
+ authenticationClientCertEnabled?: boolean;
97
+ authenticationClientCertUsernameSource?: string;
98
+ authenticationClientCertValidateDateEnabled?: boolean;
99
+ authenticationOauthEnabled?: boolean;
100
+ clientProfiles?: Array<{
101
+ name: string;
102
+ }>;
103
+ enabled?: boolean;
104
+ eventLargeMsgThreshold?: number;
105
+ managementAdminLoginCredential?: {
106
+ password?: string;
107
+ token?: string;
108
+ username?: string;
109
+ };
110
+ maxConnectionCount?: number;
111
+ maxEgressFlowCount?: number;
112
+ maxEndpointCount?: number;
113
+ maxIngressFlowCount?: number;
114
+ maxMsgSpoolUsage?: number;
115
+ maxSubscriptionCount?: number;
116
+ maxTransactedSessionCount?: number;
117
+ maxTransactionCount?: number;
118
+ missionControlManagerLoginCredential?: {
119
+ password?: string;
120
+ token?: string;
121
+ username?: string;
122
+ };
123
+ msgVpnName?: string;
124
+ sempOverMessageBus?: {
125
+ sempAccessToAdminCmdsEnabled?: boolean;
126
+ sempAccessToCacheCmdsEnabled?: boolean;
127
+ sempAccessToClientAdminCmdsEnabled?: boolean;
128
+ sempAccessToShowCmdsEnabled?: boolean;
129
+ sempOverMsgBusEnabled?: boolean;
130
+ };
131
+ serviceLoginCredential?: {
132
+ password?: string;
133
+ username?: string;
134
+ };
135
+ subDomainName?: string;
136
+ truststoreUri?: string;
137
+ }>;
138
+ redundancyGroupSslEnabled?: boolean;
139
+ solaceDatadogAgentImage?: string;
140
+ tlsStandardDomainCertificateAuthoritiesEnabled?: boolean;
141
+ version?: string;
142
+ versionFamily?: string;
143
+ };
144
+ createdBy?: string;
47
145
  createdTime?: string;
48
146
  creationState?: string;
49
147
  datacenterId?: string;
148
+ defaultManagementHostname?: string;
50
149
  environmentId?: string;
150
+ errorId?: string;
151
+ errorMessage?: string;
51
152
  eventBrokerServiceVersion?: string;
153
+ eventBrokerServiceVersionDetails?: {
154
+ releaseStatus?: string;
155
+ releaseStatusDetails?: string;
156
+ };
157
+ eventMeshId?: string;
52
158
  id: string;
159
+ infrastructureDetails?: {
160
+ backupNodeHostname?: string;
161
+ infrastructureId?: string;
162
+ monitoringNodeHostname?: string;
163
+ primaryNodeHostname?: string;
164
+ };
53
165
  infrastructureId?: string;
54
166
  locked?: boolean;
167
+ messageSpoolDetails?: {
168
+ defaultGbSize?: number;
169
+ expandedGbBilled?: number;
170
+ totalGbSize?: number;
171
+ };
55
172
  msgVpnName?: string;
56
173
  name: string;
174
+ ongoingOperationIds?: string[];
57
175
  ownedBy?: string;
58
176
  serviceClassId?: string;
177
+ serviceConnectionEndpoints?: Array<{
178
+ accessType?: string;
179
+ description?: string;
180
+ hostNames?: string[];
181
+ id?: string;
182
+ k8sServiceId?: string;
183
+ k8sServiceType?: string;
184
+ name?: string;
185
+ ports?: Array<{
186
+ port?: number;
187
+ protocol?: string;
188
+ }>;
189
+ type?: string;
190
+ }>;
59
191
  type?: string;
192
+ updatedBy?: string;
193
+ updatedTime?: string;
60
194
  }
@@ -4,3 +4,18 @@
4
4
  * @param text Text to transform.
5
5
  */
6
6
  export declare function camelCaseToTitleCase(text: string): string;
7
+ export interface ColumnConfig {
8
+ width?: number;
9
+ wrapWord?: boolean;
10
+ }
11
+ export declare function renderTable<T>(data: T[][], columnConfig?: Record<number, ColumnConfig>): string;
12
+ export declare function renderKeyValueTable<T>(data: T[][], columnConfig?: Record<number, ColumnConfig>): string;
13
+ /**
14
+ * Sleep function.
15
+ * @param ms Num of milliseconds to wait
16
+ * @returns Promise that resolves after the specified time
17
+ */
18
+ export declare function sleep(ms: number): Promise<void>;
19
+ export declare const sleepModule: {
20
+ sleep: typeof sleep;
21
+ };
@@ -1,3 +1,4 @@
1
+ import { table } from 'table';
1
2
  /**
2
3
  * Formats a camel case style `string` into a title case.
3
4
  *
@@ -10,3 +11,36 @@ export function camelCaseToTitleCase(text) {
10
11
  .replaceAll(/\s{2,}/g, ' ')
11
12
  .trim();
12
13
  }
14
+ export function renderTable(data, columnConfig) {
15
+ // Table config
16
+ const tableConfig = {
17
+ columns: columnConfig
18
+ };
19
+ const tableStr = table(data, tableConfig);
20
+ return tableStr;
21
+ }
22
+ export function renderKeyValueTable(data, columnConfig) {
23
+ if (columnConfig === undefined) {
24
+ columnConfig = { 1: { width: 50, wrapWord: true } };
25
+ }
26
+ // Table config
27
+ const tableConfig = {
28
+ columns: columnConfig,
29
+ drawHorizontalLine(lineIndex, rowCount) {
30
+ return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
31
+ },
32
+ };
33
+ const tableStr = table(data, tableConfig);
34
+ return tableStr;
35
+ }
36
+ /**
37
+ * Sleep function.
38
+ * @param ms Num of milliseconds to wait
39
+ * @returns Promise that resolves after the specified time
40
+ */
41
+ export function sleep(ms) {
42
+ return new Promise((resolve) => {
43
+ setTimeout(resolve, ms);
44
+ });
45
+ }
46
+ export const sleepModule = { sleep };
@@ -5,6 +5,7 @@ export declare class ScConnection {
5
5
  constructor(baseURL?: string, accessToken?: string, timeout?: number);
6
6
  delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
7
7
  get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
8
+ patch<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
8
9
  post<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
9
10
  put<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
10
11
  private joinPaths;
@@ -30,6 +30,11 @@ export class ScConnection {
30
30
  const response = await this.axiosInstance.get(url, config);
31
31
  return response.data;
32
32
  }
33
+ // PATCH request
34
+ async patch(url, data, config) {
35
+ const response = await this.axiosInstance.patch(url, data, config);
36
+ return response.data;
37
+ }
33
38
  // POST request
34
39
  async post(url, data, config) {
35
40
  const response = await this.axiosInstance.post(url, data, config);