@quantum-hub/qhubctl 1.9.0 → 1.11.0

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 (155) hide show
  1. package/README.md +6 -35
  2. package/dist/commands/datapool-upload.js +7 -3
  3. package/dist/commands/init.js +2 -27
  4. package/dist/commands/list-contexts.js +1 -1
  5. package/dist/commands/services-build-status.js +1 -1
  6. package/dist/commands/set-context.js +6 -2
  7. package/dist/commands/up.js +11 -15
  8. package/dist/lib/error.js +25 -8
  9. package/dist/lib/repository.d.ts +1 -4
  10. package/dist/lib/repository.js +2 -9
  11. package/dist/service/quantum-hub-service.d.ts +9 -13
  12. package/dist/service/quantum-hub-service.js +67 -139
  13. package/package.json +2 -2
  14. package/dist/client/kqh/apis/ServicePlatformApplicationsApi.d.ts +0 -89
  15. package/dist/client/kqh/apis/ServicePlatformApplicationsApi.js +0 -222
  16. package/dist/client/kqh/apis/ServicePlatformDashboardApi.d.ts +0 -44
  17. package/dist/client/kqh/apis/ServicePlatformDashboardApi.js +0 -106
  18. package/dist/client/kqh/apis/ServicePlatformDataPoolsApi.d.ts +0 -133
  19. package/dist/client/kqh/apis/ServicePlatformDataPoolsApi.js +0 -373
  20. package/dist/client/kqh/apis/ServicePlatformJobsApi.d.ts +0 -101
  21. package/dist/client/kqh/apis/ServicePlatformJobsApi.js +0 -261
  22. package/dist/client/kqh/apis/ServicePlatformMarketplaceApi.d.ts +0 -48
  23. package/dist/client/kqh/apis/ServicePlatformMarketplaceApi.js +0 -115
  24. package/dist/client/kqh/apis/ServicePlatformMeteringAPIApi.d.ts +0 -29
  25. package/dist/client/kqh/apis/ServicePlatformMeteringAPIApi.js +0 -53
  26. package/dist/client/kqh/apis/ServicePlatformServicesApi.d.ts +0 -501
  27. package/dist/client/kqh/apis/ServicePlatformServicesApi.js +0 -1472
  28. package/dist/client/kqh/apis/ServicePlatformSubscriptionsApi.d.ts +0 -66
  29. package/dist/client/kqh/apis/ServicePlatformSubscriptionsApi.js +0 -157
  30. package/dist/client/kqh/apis/TaxonomiesApi.d.ts +0 -90
  31. package/dist/client/kqh/apis/TaxonomiesApi.js +0 -272
  32. package/dist/client/kqh/apis/index.d.ts +0 -9
  33. package/dist/client/kqh/apis/index.js +0 -11
  34. package/dist/client/kqh/index.d.ts +0 -3
  35. package/dist/client/kqh/index.js +0 -5
  36. package/dist/client/kqh/models/AccessTokenDto.d.ts +0 -81
  37. package/dist/client/kqh/models/AccessTokenDto.js +0 -59
  38. package/dist/client/kqh/models/AmountMajorDto.d.ts +0 -37
  39. package/dist/client/kqh/models/AmountMajorDto.js +0 -40
  40. package/dist/client/kqh/models/ApiDto.d.ts +0 -144
  41. package/dist/client/kqh/models/ApiDto.js +0 -92
  42. package/dist/client/kqh/models/ApiOverviewDto.d.ts +0 -119
  43. package/dist/client/kqh/models/ApiOverviewDto.js +0 -83
  44. package/dist/client/kqh/models/ApplicationDto.d.ts +0 -64
  45. package/dist/client/kqh/models/ApplicationDto.js +0 -53
  46. package/dist/client/kqh/models/BuildJobDto.d.ts +0 -75
  47. package/dist/client/kqh/models/BuildJobDto.js +0 -64
  48. package/dist/client/kqh/models/CpuConfiguration.d.ts +0 -38
  49. package/dist/client/kqh/models/CpuConfiguration.js +0 -43
  50. package/dist/client/kqh/models/CreateApplicationRequest.d.ts +0 -31
  51. package/dist/client/kqh/models/CreateApplicationRequest.js +0 -38
  52. package/dist/client/kqh/models/CreateDataPoolRequest.d.ts +0 -31
  53. package/dist/client/kqh/models/CreateDataPoolRequest.js +0 -40
  54. package/dist/client/kqh/models/CreateExternalServicePricingPlanRequest.d.ts +0 -46
  55. package/dist/client/kqh/models/CreateExternalServicePricingPlanRequest.js +0 -50
  56. package/dist/client/kqh/models/CreateJobRequest.d.ts +0 -62
  57. package/dist/client/kqh/models/CreateJobRequest.js +0 -51
  58. package/dist/client/kqh/models/CreateManagedServicePricingPlanRequest.d.ts +0 -73
  59. package/dist/client/kqh/models/CreateManagedServicePricingPlanRequest.js +0 -72
  60. package/dist/client/kqh/models/CreateProductRequest.d.ts +0 -43
  61. package/dist/client/kqh/models/CreateProductRequest.js +0 -46
  62. package/dist/client/kqh/models/CreateSubscriptionRequest.d.ts +0 -37
  63. package/dist/client/kqh/models/CreateSubscriptionRequest.js +0 -44
  64. package/dist/client/kqh/models/CreateWorkflowServiceRequest.d.ts +0 -37
  65. package/dist/client/kqh/models/CreateWorkflowServiceRequest.js +0 -42
  66. package/dist/client/kqh/models/DataPoolDto.d.ts +0 -166
  67. package/dist/client/kqh/models/DataPoolDto.js +0 -98
  68. package/dist/client/kqh/models/DataPoolRef.d.ts +0 -43
  69. package/dist/client/kqh/models/DataPoolRef.js +0 -42
  70. package/dist/client/kqh/models/DataSourceDescriptorDto.d.ts +0 -89
  71. package/dist/client/kqh/models/DataSourceDescriptorDto.js +0 -62
  72. package/dist/client/kqh/models/FileDto.d.ts +0 -73
  73. package/dist/client/kqh/models/FileDto.js +0 -45
  74. package/dist/client/kqh/models/FileSource.d.ts +0 -26
  75. package/dist/client/kqh/models/FileSource.js +0 -28
  76. package/dist/client/kqh/models/GpuConfiguration.d.ts +0 -49
  77. package/dist/client/kqh/models/GpuConfiguration.js +0 -53
  78. package/dist/client/kqh/models/JobDto.d.ts +0 -117
  79. package/dist/client/kqh/models/JobDto.js +0 -75
  80. package/dist/client/kqh/models/JobOverviewDto.d.ts +0 -74
  81. package/dist/client/kqh/models/JobOverviewDto.js +0 -60
  82. package/dist/client/kqh/models/MemoryConfiguration.d.ts +0 -38
  83. package/dist/client/kqh/models/MemoryConfiguration.js +0 -43
  84. package/dist/client/kqh/models/MeteringRequest.d.ts +0 -43
  85. package/dist/client/kqh/models/MeteringRequest.js +0 -42
  86. package/dist/client/kqh/models/MeteringResponse.d.ts +0 -49
  87. package/dist/client/kqh/models/MeteringResponse.js +0 -44
  88. package/dist/client/kqh/models/MonthAmountDto.d.ts +0 -51
  89. package/dist/client/kqh/models/MonthAmountDto.js +0 -46
  90. package/dist/client/kqh/models/OwnerDto.d.ts +0 -67
  91. package/dist/client/kqh/models/OwnerDto.js +0 -50
  92. package/dist/client/kqh/models/PageDataPoolDto.d.ts +0 -94
  93. package/dist/client/kqh/models/PageDataPoolDto.js +0 -61
  94. package/dist/client/kqh/models/PageableObject.d.ts +0 -62
  95. package/dist/client/kqh/models/PageableObject.js +0 -49
  96. package/dist/client/kqh/models/PricingPlanDto.d.ts +0 -52
  97. package/dist/client/kqh/models/PricingPlanDto.js +0 -50
  98. package/dist/client/kqh/models/ProductAmountDto.d.ts +0 -38
  99. package/dist/client/kqh/models/ProductAmountDto.js +0 -41
  100. package/dist/client/kqh/models/ProductDto.d.ts +0 -83
  101. package/dist/client/kqh/models/ProductDto.js +0 -69
  102. package/dist/client/kqh/models/ProductGroupDto.d.ts +0 -45
  103. package/dist/client/kqh/models/ProductGroupDto.js +0 -44
  104. package/dist/client/kqh/models/ProductUsageDto.d.ts +0 -61
  105. package/dist/client/kqh/models/ProductUsageDto.js +0 -48
  106. package/dist/client/kqh/models/RegistrySource.d.ts +0 -52
  107. package/dist/client/kqh/models/RegistrySource.js +0 -49
  108. package/dist/client/kqh/models/RepositorySource.d.ts +0 -32
  109. package/dist/client/kqh/models/RepositorySource.js +0 -41
  110. package/dist/client/kqh/models/ResourceConfiguration.d.ts +0 -31
  111. package/dist/client/kqh/models/ResourceConfiguration.js +0 -52
  112. package/dist/client/kqh/models/ReviewDto.d.ts +0 -51
  113. package/dist/client/kqh/models/ReviewDto.js +0 -49
  114. package/dist/client/kqh/models/RuntimeConfiguration.d.ts +0 -53
  115. package/dist/client/kqh/models/RuntimeConfiguration.js +0 -49
  116. package/dist/client/kqh/models/ServiceDefinitionCommand.d.ts +0 -39
  117. package/dist/client/kqh/models/ServiceDefinitionCommand.js +0 -45
  118. package/dist/client/kqh/models/ServiceDefinitionDto.d.ts +0 -180
  119. package/dist/client/kqh/models/ServiceDefinitionDto.js +0 -101
  120. package/dist/client/kqh/models/ServiceDefinitionDtoSource.d.ts +0 -23
  121. package/dist/client/kqh/models/ServiceDefinitionDtoSource.js +0 -49
  122. package/dist/client/kqh/models/ServiceDefinitionOverviewDto.d.ts +0 -79
  123. package/dist/client/kqh/models/ServiceDefinitionOverviewDto.js +0 -64
  124. package/dist/client/kqh/models/ServiceDto.d.ts +0 -59
  125. package/dist/client/kqh/models/ServiceDto.js +0 -52
  126. package/dist/client/kqh/models/ServiceExecutionConsumerDto.d.ts +0 -67
  127. package/dist/client/kqh/models/ServiceExecutionConsumerDto.js +0 -57
  128. package/dist/client/kqh/models/ServiceExecutionDto.d.ts +0 -49
  129. package/dist/client/kqh/models/ServiceExecutionDto.js +0 -44
  130. package/dist/client/kqh/models/ServiceOverviewDto.d.ts +0 -115
  131. package/dist/client/kqh/models/ServiceOverviewDto.js +0 -85
  132. package/dist/client/kqh/models/ServiceSource.d.ts +0 -31
  133. package/dist/client/kqh/models/ServiceSource.js +0 -52
  134. package/dist/client/kqh/models/SortObject.d.ts +0 -43
  135. package/dist/client/kqh/models/SortObject.js +0 -42
  136. package/dist/client/kqh/models/SubscriptionDto.d.ts +0 -58
  137. package/dist/client/kqh/models/SubscriptionDto.js +0 -49
  138. package/dist/client/kqh/models/TaxonomyElement.d.ts +0 -43
  139. package/dist/client/kqh/models/TaxonomyElement.js +0 -42
  140. package/dist/client/kqh/models/UpdateDataPoolRequest.d.ts +0 -109
  141. package/dist/client/kqh/models/UpdateDataPoolRequest.js +0 -66
  142. package/dist/client/kqh/models/UpdateResourceConfigurationRequest.d.ts +0 -23
  143. package/dist/client/kqh/models/UpdateResourceConfigurationRequest.js +0 -49
  144. package/dist/client/kqh/models/UpdateVersionRequest.d.ts +0 -44
  145. package/dist/client/kqh/models/UpdateVersionRequest.js +0 -43
  146. package/dist/client/kqh/models/UpdateWorkflowServiceRequest.d.ts +0 -31
  147. package/dist/client/kqh/models/UpdateWorkflowServiceRequest.js +0 -27
  148. package/dist/client/kqh/models/ValidationResult.d.ts +0 -52
  149. package/dist/client/kqh/models/ValidationResult.js +0 -50
  150. package/dist/client/kqh/models/index.d.ts +0 -57
  151. package/dist/client/kqh/models/index.js +0 -59
  152. package/dist/client/kqh/runtime.d.ts +0 -181
  153. package/dist/client/kqh/runtime.js +0 -325
  154. package/dist/model/account.d.ts +0 -5
  155. package/dist/model/account.js +0 -1
@@ -1,93 +1,68 @@
1
1
  import { HubPlatformClient } from "@quantum-hub/qhub-api/platform";
2
- import { Configuration, ServicePlatformServicesApi, } from '../client/kqh/index.js';
3
2
  import { handleError } from '../lib/error.js';
4
- import { fetchOrThrow } from '../lib/fetch.js';
5
3
  import { defaultBasePath } from '../model/user-config.js';
6
4
  import { CommandService } from './command-service.js';
7
5
  export default class QuantumHubService extends CommandService {
8
- serviceApi;
9
6
  apiClient;
10
7
  constructor(userConfig) {
11
8
  super(userConfig);
12
9
  const basePath = (userConfig.endpoint?.basePath || defaultBasePath) + '/qc-catalog';
13
- const defaultHeaders = userConfig.endpoint?.defaultHeaders || {};
14
10
  const apiKey = userConfig.auth?.value;
15
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
16
- this.serviceApi = new ServicePlatformServicesApi(new Configuration({
17
- apiKey,
18
- basePath,
19
- headers: defaultHeaders,
20
- }));
11
+ const organizationId = userConfig.context?.isOrganization ? userConfig.context.id : undefined;
21
12
  this.apiClient = new HubPlatformClient({
22
13
  apiKey,
23
14
  baseUrl: basePath,
24
- organizationId
15
+ headers: {
16
+ 'X-OrganizationId': organizationId,
17
+ },
25
18
  });
26
19
  }
27
- async createService(serviceConfig, sourceCode, apiDefinition) {
28
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
29
- const milliCpus = (serviceConfig.resources?.cpu || 1) * 1000;
30
- const memoryInMegabytes = (serviceConfig.resources?.memory || 2) * 1024;
31
- const gpuAccelerator = serviceConfig.resources?.gpu?.type || 'NONE';
32
- const gpuCount = serviceConfig.resources?.gpu?.count || 0;
33
- try {
34
- return await this.serviceApi.createManagedService({
35
- apiDefinition,
36
- gpuAccelerator,
37
- gpuCount,
38
- memoryInMegabytes,
39
- milliCpus,
40
- name: serviceConfig.name,
41
- runtime: serviceConfig.runtime,
42
- userCode: sourceCode,
43
- xOrganizationId: organizationId,
44
- });
45
- }
46
- catch (error) {
47
- const errorMessage = await handleError(error);
48
- throw new Error(errorMessage);
49
- }
50
- }
51
20
  async getAccounts() {
52
- const basePath = (this.userConfig.endpoint?.basePath || defaultBasePath) + '/qc-catalog';
53
21
  try {
54
- const response = await fetchOrThrow(basePath + '/my/accounts', {
55
- headers: { 'X-Auth-Token': this.userConfig.auth.value },
56
- });
57
- return (await response.json());
22
+ return await this.apiClient.users.getAccounts();
58
23
  }
59
24
  catch (error) {
60
25
  const errorMessage = await handleError(error);
61
26
  throw new Error(errorMessage);
62
27
  }
63
28
  }
64
- async getBuildJob(service, serviceDefinition) {
65
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
29
+ async createService(serviceConfig, sourceCode, apiDefinition) {
30
+ const milliCpus = (serviceConfig.resources?.cpu || 1) * 1000;
31
+ const memoryInMegabytes = (serviceConfig.resources?.memory || 2) * 1024;
32
+ const gpuAccelerator = serviceConfig.resources?.gpu?.type || 'NONE';
33
+ const gpuCount = serviceConfig.resources?.gpu?.count || 0;
66
34
  try {
67
- return await this.serviceApi.getBuildStatus({
68
- serviceId: service.id,
69
- versionId: serviceDefinition.id,
70
- xOrganizationId: organizationId,
35
+ const service = await this.apiClient.managedServices.createManagedService({
36
+ name: serviceConfig.name,
37
+ runtimeConfiguration: {
38
+ runtime: serviceConfig.runtime,
39
+ },
40
+ resourceConfigurations: [
41
+ { type: 'cpu', amount: milliCpus, unit: 'm' },
42
+ { type: 'memory', amount: memoryInMegabytes, unit: 'M' },
43
+ {
44
+ type: 'gpu',
45
+ amount: gpuCount,
46
+ accelerator: gpuAccelerator
47
+ },
48
+ ],
49
+ source: { type: 'file' },
50
+ summary: serviceConfig.summary,
71
51
  });
52
+ await this.uploadSourceCode(service.id, sourceCode);
53
+ if (apiDefinition) {
54
+ await this.apiClient.services.updateServiceOpenApi(service.id, { file: apiDefinition });
55
+ }
56
+ return service;
72
57
  }
73
58
  catch (error) {
74
59
  const errorMessage = await handleError(error);
75
60
  throw new Error(errorMessage);
76
61
  }
77
62
  }
78
- async getBuildJobByServiceId(serviceId) {
79
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
80
- const service = await this.getService(serviceId);
81
- const serviceDefinition = service?.serviceDefinitions?.[0];
82
- if (!serviceDefinition?.id) {
83
- throw new Error(`No service version found for service '${serviceId}'`);
84
- }
63
+ async getBuildJob(id) {
85
64
  try {
86
- return await this.serviceApi.getBuildStatus({
87
- serviceId: service.id,
88
- versionId: serviceDefinition.id,
89
- xOrganizationId: organizationId,
90
- });
65
+ return await this.apiClient.managedServices.getManagedServiceBuildStatus(id);
91
66
  }
92
67
  catch (error) {
93
68
  const errorMessage = await handleError(error);
@@ -96,7 +71,7 @@ export default class QuantumHubService extends CommandService {
96
71
  }
97
72
  async getJobById(id) {
98
73
  try {
99
- return await this.apiClient.serviceJobs.getServiceJob({ "id": id });
74
+ return await this.apiClient.serviceJobs.getServiceJob(id);
100
75
  }
101
76
  catch (error) {
102
77
  const errorMessage = await handleError(error);
@@ -104,9 +79,8 @@ export default class QuantumHubService extends CommandService {
104
79
  }
105
80
  }
106
81
  async getService(id) {
107
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
108
82
  try {
109
- return await this.serviceApi.getService({ id, xOrganizationId: organizationId });
83
+ return await this.apiClient.services.getService(id);
110
84
  }
111
85
  catch (error) {
112
86
  const errorMessage = await handleError(error);
@@ -114,9 +88,8 @@ export default class QuantumHubService extends CommandService {
114
88
  }
115
89
  }
116
90
  async getServices() {
117
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
118
91
  try {
119
- return await this.serviceApi.getServices({ xOrganizationId: organizationId });
92
+ return await this.apiClient.services.getServices();
120
93
  }
121
94
  catch (error) {
122
95
  const errorMessage = await handleError(error);
@@ -133,106 +106,61 @@ export default class QuantumHubService extends CommandService {
133
106
  }
134
107
  }
135
108
  async updateDescription(serviceConfig, description) {
136
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
137
- const service = await this.serviceApi.getService({ id: serviceConfig.serviceId, xOrganizationId: organizationId });
138
- const serviceDefinition = service?.serviceDefinitions?.[0];
139
109
  try {
140
- await this.serviceApi.updateServiceVersion({
141
- serviceId: service.id,
142
- updateVersionRequest: { description },
143
- versionId: serviceDefinition.id,
144
- xOrganizationId: organizationId,
145
- });
110
+ await this.apiClient.services.updateServiceDescription(serviceConfig.serviceId, { description });
146
111
  }
147
112
  catch (error) {
148
113
  const errorMessage = await handleError(error);
149
114
  throw new Error(errorMessage);
150
115
  }
151
116
  }
152
- async updateOpenapi(serviceConfig, apiDefinition) {
153
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
154
- const service = await this.serviceApi.getService({ id: serviceConfig.serviceId, xOrganizationId: organizationId });
155
- const serviceDefinition = service?.serviceDefinitions?.[0];
156
- if (apiDefinition) {
157
- await this.serviceApi.updateApiDefinition({
158
- file: apiDefinition,
159
- serviceId: service.id,
160
- versionId: serviceDefinition.id,
161
- xOrganizationId: organizationId,
162
- });
117
+ async updateOpenapi(serviceConfig, openapi) {
118
+ try {
119
+ await this.apiClient.services.updateServiceOpenApi(serviceConfig.serviceId, { file: openapi });
120
+ }
121
+ catch (error) {
122
+ const errorMessage = await handleError(error);
123
+ throw new Error(errorMessage);
163
124
  }
164
125
  }
165
- async updateService(serviceConfig, description, sourceCode, apiDefinition) {
166
- const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
167
- const service = await this.serviceApi.getService({ id: serviceConfig.serviceId, xOrganizationId: organizationId });
168
- const serviceDefinition = service?.serviceDefinitions?.[0];
126
+ async updateService(serviceConfig, description, sourceCode, openapi) {
127
+ const serviceId = serviceConfig.serviceId;
169
128
  const milliCpus = (serviceConfig.resources?.cpu || 1) * 1000;
170
- const cpuConfiguration = {
171
- amount: milliCpus,
172
- type: 'cpu',
173
- unit: 'm',
174
- };
175
129
  const memoryInMegabytes = (serviceConfig.resources?.memory || 2) * 1024;
176
- const memoryConfiguration = {
177
- amount: memoryInMegabytes,
178
- type: 'memory',
179
- unit: 'M',
180
- };
181
130
  const gpuAccelerator = serviceConfig.resources?.gpu?.type || 'NONE';
182
131
  const gpuCount = serviceConfig.resources?.gpu?.count || 0;
183
- const gpuConfiguration = {
184
- accelerator: gpuAccelerator,
185
- amount: gpuCount,
186
- type: 'gpu',
187
- };
188
132
  try {
189
133
  if (description) {
190
- await this.serviceApi.updateServiceVersion({
191
- serviceId: service.id,
192
- updateVersionRequest: {
193
- description,
194
- },
195
- versionId: serviceDefinition.id,
196
- xOrganizationId: organizationId,
197
- });
134
+ await this.apiClient.services.updateServiceDescription(serviceId, { description });
198
135
  }
199
- await this.serviceApi.updateResourceConfiguration({
200
- serviceId: service.id,
201
- updateResourceConfigurationRequest: cpuConfiguration,
202
- versionId: serviceDefinition.id,
203
- xOrganizationId: organizationId,
136
+ if (serviceConfig.summary) {
137
+ await this.apiClient.services.updateServiceSummary(serviceId, { summary: serviceConfig.summary });
138
+ }
139
+ await this.apiClient.managedServices.updateManagedServiceResourceConfiguration(serviceId, {
140
+ body: { type: 'cpu', amount: milliCpus, unit: 'm' },
204
141
  });
205
- await this.serviceApi.updateResourceConfiguration({
206
- serviceId: service.id,
207
- updateResourceConfigurationRequest: memoryConfiguration,
208
- versionId: serviceDefinition.id,
209
- xOrganizationId: organizationId,
142
+ await this.apiClient.managedServices.updateManagedServiceResourceConfiguration(serviceId, {
143
+ body: { type: 'memory', amount: memoryInMegabytes, unit: 'M' },
210
144
  });
211
- await this.serviceApi.updateResourceConfiguration({
212
- serviceId: service.id,
213
- updateResourceConfigurationRequest: gpuConfiguration,
214
- versionId: serviceDefinition.id,
215
- xOrganizationId: organizationId,
145
+ await this.apiClient.managedServices.updateManagedServiceResourceConfiguration(serviceId, {
146
+ body: {
147
+ type: 'gpu',
148
+ amount: gpuCount,
149
+ accelerator: gpuAccelerator
150
+ },
216
151
  });
217
- if (apiDefinition) {
218
- await this.serviceApi.updateApiDefinition({
219
- file: apiDefinition,
220
- serviceId: service.id,
221
- versionId: serviceDefinition.id,
222
- xOrganizationId: organizationId,
223
- });
152
+ if (openapi) {
153
+ await this.apiClient.services.updateServiceOpenApi(serviceId, { file: openapi });
224
154
  }
225
- await this.serviceApi.updateSourceCodePost({
226
- file: sourceCode,
227
- serviceId: service.id,
228
- versionId: serviceDefinition.id,
229
- xOrganizationId: organizationId,
230
- });
231
- return service;
155
+ await this.uploadSourceCode(serviceId, sourceCode);
156
+ return await this.getService(serviceId);
232
157
  }
233
158
  catch (error) {
234
159
  const errorMessage = await handleError(error);
235
160
  throw new Error(errorMessage);
236
161
  }
237
162
  }
163
+ async uploadSourceCode(serviceId, sourceCode) {
164
+ await this.apiClient.managedServices.uploadManagedServiceSource(serviceId, { file: sourceCode });
165
+ }
238
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantum-hub/qhubctl",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Kipu Quantum Hub CLI",
5
5
  "author": "Kipu Quantum GmbH",
6
6
  "contributors": [
@@ -32,7 +32,7 @@
32
32
  "commander": "^14",
33
33
  "fs-extra": "^11",
34
34
  "ignore": "^7",
35
- "isomorphic-git": "^1.37.2",
35
+ "isomorphic-git": "^1",
36
36
  "ora": "^9",
37
37
  "tty-table": "^5",
38
38
  "update-notifier": "^7",
@@ -1,89 +0,0 @@
1
- /**
2
- * Quantum Platform API
3
- * Part of the OpenAPI specification for the Quantum Platform.
4
- *
5
- * The version of the OpenAPI document: v1
6
- * Contact: info@anaqor.io
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import * as runtime from '../runtime.js';
13
- import type { AccessTokenDto, ApplicationDto, CreateApplicationRequest, SubscriptionDto } from '../models/index.js';
14
- export interface CreateApplicationOperationRequest {
15
- createApplicationRequest: CreateApplicationRequest;
16
- xOrganizationId?: string;
17
- }
18
- export interface DeleteApplicationRequest {
19
- id: string;
20
- xOrganizationId?: string;
21
- }
22
- export interface GetAccessTokenRequest {
23
- id: string;
24
- xOrganizationId?: string;
25
- }
26
- export interface GetApplicationRequest {
27
- id: string;
28
- xOrganizationId?: string;
29
- }
30
- export interface GetApplicationSubscriptionsRequest {
31
- id: string;
32
- xOrganizationId?: string;
33
- }
34
- export interface GetApplicationsRequest {
35
- xOrganizationId?: string;
36
- }
37
- /**
38
- *
39
- */
40
- export declare class ServicePlatformApplicationsApi extends runtime.BaseAPI {
41
- /**
42
- * Creates a new application within your organization or for yourself.
43
- */
44
- createApplicationRaw(requestParameters: CreateApplicationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationDto>>;
45
- /**
46
- * Creates a new application within your organization or for yourself.
47
- */
48
- createApplication(requestParameters: CreateApplicationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationDto>;
49
- /**
50
- * Deletes an application.
51
- */
52
- deleteApplicationRaw(requestParameters: DeleteApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
53
- /**
54
- * Deletes an application.
55
- */
56
- deleteApplication(requestParameters: DeleteApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
57
- /**
58
- * Gets the access token for your application. The access token must be used to authenticate execution requests to subscribed services.
59
- */
60
- getAccessTokenRaw(requestParameters: GetAccessTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccessTokenDto>>;
61
- /**
62
- * Gets the access token for your application. The access token must be used to authenticate execution requests to subscribed services.
63
- */
64
- getAccessToken(requestParameters: GetAccessTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccessTokenDto>;
65
- /**
66
- * Gets an specific application and its basic properties.
67
- */
68
- getApplicationRaw(requestParameters: GetApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationDto>>;
69
- /**
70
- * Gets an specific application and its basic properties.
71
- */
72
- getApplication(requestParameters: GetApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationDto>;
73
- /**
74
- * Gets a list of all subscriptions of an application. This information concerns the services this application is subscribe to, either internal or public (through the marketplace API) subscriptions.
75
- */
76
- getApplicationSubscriptionsRaw(requestParameters: GetApplicationSubscriptionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SubscriptionDto>>>;
77
- /**
78
- * Gets a list of all subscriptions of an application. This information concerns the services this application is subscribe to, either internal or public (through the marketplace API) subscriptions.
79
- */
80
- getApplicationSubscriptions(requestParameters: GetApplicationSubscriptionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SubscriptionDto>>;
81
- /**
82
- * Gets a list of all applications.
83
- */
84
- getApplicationsRaw(requestParameters: GetApplicationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ApplicationDto>>>;
85
- /**
86
- * Gets a list of all applications.
87
- */
88
- getApplications(requestParameters?: GetApplicationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ApplicationDto>>;
89
- }
@@ -1,222 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Quantum Platform API
5
- * Part of the OpenAPI specification for the Quantum Platform.
6
- *
7
- * The version of the OpenAPI document: v1
8
- * Contact: info@anaqor.io
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
- import * as runtime from '../runtime.js';
15
- import { AccessTokenDtoFromJSON, ApplicationDtoFromJSON, CreateApplicationRequestToJSON, SubscriptionDtoFromJSON, } from '../models/index.js';
16
- /**
17
- *
18
- */
19
- export class ServicePlatformApplicationsApi extends runtime.BaseAPI {
20
- /**
21
- * Creates a new application within your organization or for yourself.
22
- */
23
- async createApplicationRaw(requestParameters, initOverrides) {
24
- if (requestParameters['createApplicationRequest'] == null) {
25
- throw new runtime.RequiredError('createApplicationRequest', 'Required parameter "createApplicationRequest" was null or undefined when calling createApplication().');
26
- }
27
- const queryParameters = {};
28
- const headerParameters = {};
29
- headerParameters['Content-Type'] = 'application/json';
30
- if (requestParameters['xOrganizationId'] != null) {
31
- headerParameters['X-OrganizationId'] = String(requestParameters['xOrganizationId']);
32
- }
33
- if (this.configuration && this.configuration.apiKey) {
34
- headerParameters["X-Auth-Token"] = await this.configuration.apiKey("X-Auth-Token"); // apiKey authentication
35
- }
36
- if (this.configuration && this.configuration.accessToken) {
37
- // oauth required
38
- headerParameters["Authorization"] = await this.configuration.accessToken("oauth2", []);
39
- }
40
- const response = await this.request({
41
- path: `/v2/applications`,
42
- method: 'POST',
43
- headers: headerParameters,
44
- query: queryParameters,
45
- body: CreateApplicationRequestToJSON(requestParameters['createApplicationRequest']),
46
- }, initOverrides);
47
- return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationDtoFromJSON(jsonValue));
48
- }
49
- /**
50
- * Creates a new application within your organization or for yourself.
51
- */
52
- async createApplication(requestParameters, initOverrides) {
53
- const response = await this.createApplicationRaw(requestParameters, initOverrides);
54
- return await response.value();
55
- }
56
- /**
57
- * Deletes an application.
58
- */
59
- async deleteApplicationRaw(requestParameters, initOverrides) {
60
- if (requestParameters['id'] == null) {
61
- throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteApplication().');
62
- }
63
- const queryParameters = {};
64
- const headerParameters = {};
65
- if (requestParameters['xOrganizationId'] != null) {
66
- headerParameters['X-OrganizationId'] = String(requestParameters['xOrganizationId']);
67
- }
68
- if (this.configuration && this.configuration.apiKey) {
69
- headerParameters["X-Auth-Token"] = await this.configuration.apiKey("X-Auth-Token"); // apiKey authentication
70
- }
71
- if (this.configuration && this.configuration.accessToken) {
72
- // oauth required
73
- headerParameters["Authorization"] = await this.configuration.accessToken("oauth2", []);
74
- }
75
- const response = await this.request({
76
- path: `/v2/applications/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
77
- method: 'DELETE',
78
- headers: headerParameters,
79
- query: queryParameters,
80
- }, initOverrides);
81
- return new runtime.VoidApiResponse(response);
82
- }
83
- /**
84
- * Deletes an application.
85
- */
86
- async deleteApplication(requestParameters, initOverrides) {
87
- await this.deleteApplicationRaw(requestParameters, initOverrides);
88
- }
89
- /**
90
- * Gets the access token for your application. The access token must be used to authenticate execution requests to subscribed services.
91
- */
92
- async getAccessTokenRaw(requestParameters, initOverrides) {
93
- if (requestParameters['id'] == null) {
94
- throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getAccessToken().');
95
- }
96
- const queryParameters = {};
97
- const headerParameters = {};
98
- if (requestParameters['xOrganizationId'] != null) {
99
- headerParameters['X-OrganizationId'] = String(requestParameters['xOrganizationId']);
100
- }
101
- if (this.configuration && this.configuration.apiKey) {
102
- headerParameters["X-Auth-Token"] = await this.configuration.apiKey("X-Auth-Token"); // apiKey authentication
103
- }
104
- if (this.configuration && this.configuration.accessToken) {
105
- // oauth required
106
- headerParameters["Authorization"] = await this.configuration.accessToken("oauth2", []);
107
- }
108
- const response = await this.request({
109
- path: `/v2/applications/{id}/access-token`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
110
- method: 'POST',
111
- headers: headerParameters,
112
- query: queryParameters,
113
- }, initOverrides);
114
- return new runtime.JSONApiResponse(response, (jsonValue) => AccessTokenDtoFromJSON(jsonValue));
115
- }
116
- /**
117
- * Gets the access token for your application. The access token must be used to authenticate execution requests to subscribed services.
118
- */
119
- async getAccessToken(requestParameters, initOverrides) {
120
- const response = await this.getAccessTokenRaw(requestParameters, initOverrides);
121
- return await response.value();
122
- }
123
- /**
124
- * Gets an specific application and its basic properties.
125
- */
126
- async getApplicationRaw(requestParameters, initOverrides) {
127
- if (requestParameters['id'] == null) {
128
- throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getApplication().');
129
- }
130
- const queryParameters = {};
131
- const headerParameters = {};
132
- if (requestParameters['xOrganizationId'] != null) {
133
- headerParameters['X-OrganizationId'] = String(requestParameters['xOrganizationId']);
134
- }
135
- if (this.configuration && this.configuration.apiKey) {
136
- headerParameters["X-Auth-Token"] = await this.configuration.apiKey("X-Auth-Token"); // apiKey authentication
137
- }
138
- if (this.configuration && this.configuration.accessToken) {
139
- // oauth required
140
- headerParameters["Authorization"] = await this.configuration.accessToken("oauth2", []);
141
- }
142
- const response = await this.request({
143
- path: `/v2/applications/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
144
- method: 'GET',
145
- headers: headerParameters,
146
- query: queryParameters,
147
- }, initOverrides);
148
- return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationDtoFromJSON(jsonValue));
149
- }
150
- /**
151
- * Gets an specific application and its basic properties.
152
- */
153
- async getApplication(requestParameters, initOverrides) {
154
- const response = await this.getApplicationRaw(requestParameters, initOverrides);
155
- return await response.value();
156
- }
157
- /**
158
- * Gets a list of all subscriptions of an application. This information concerns the services this application is subscribe to, either internal or public (through the marketplace API) subscriptions.
159
- */
160
- async getApplicationSubscriptionsRaw(requestParameters, initOverrides) {
161
- if (requestParameters['id'] == null) {
162
- throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getApplicationSubscriptions().');
163
- }
164
- const queryParameters = {};
165
- const headerParameters = {};
166
- if (requestParameters['xOrganizationId'] != null) {
167
- headerParameters['X-OrganizationId'] = String(requestParameters['xOrganizationId']);
168
- }
169
- if (this.configuration && this.configuration.apiKey) {
170
- headerParameters["X-Auth-Token"] = await this.configuration.apiKey("X-Auth-Token"); // apiKey authentication
171
- }
172
- if (this.configuration && this.configuration.accessToken) {
173
- // oauth required
174
- headerParameters["Authorization"] = await this.configuration.accessToken("oauth2", []);
175
- }
176
- const response = await this.request({
177
- path: `/v2/applications/{id}/subscriptions`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
178
- method: 'GET',
179
- headers: headerParameters,
180
- query: queryParameters,
181
- }, initOverrides);
182
- return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(SubscriptionDtoFromJSON));
183
- }
184
- /**
185
- * Gets a list of all subscriptions of an application. This information concerns the services this application is subscribe to, either internal or public (through the marketplace API) subscriptions.
186
- */
187
- async getApplicationSubscriptions(requestParameters, initOverrides) {
188
- const response = await this.getApplicationSubscriptionsRaw(requestParameters, initOverrides);
189
- return await response.value();
190
- }
191
- /**
192
- * Gets a list of all applications.
193
- */
194
- async getApplicationsRaw(requestParameters, initOverrides) {
195
- const queryParameters = {};
196
- const headerParameters = {};
197
- if (requestParameters['xOrganizationId'] != null) {
198
- headerParameters['X-OrganizationId'] = String(requestParameters['xOrganizationId']);
199
- }
200
- if (this.configuration && this.configuration.apiKey) {
201
- headerParameters["X-Auth-Token"] = await this.configuration.apiKey("X-Auth-Token"); // apiKey authentication
202
- }
203
- if (this.configuration && this.configuration.accessToken) {
204
- // oauth required
205
- headerParameters["Authorization"] = await this.configuration.accessToken("oauth2", []);
206
- }
207
- const response = await this.request({
208
- path: `/v2/applications`,
209
- method: 'GET',
210
- headers: headerParameters,
211
- query: queryParameters,
212
- }, initOverrides);
213
- return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ApplicationDtoFromJSON));
214
- }
215
- /**
216
- * Gets a list of all applications.
217
- */
218
- async getApplications(requestParameters = {}, initOverrides) {
219
- const response = await this.getApplicationsRaw(requestParameters, initOverrides);
220
- return await response.value();
221
- }
222
- }
@@ -1,44 +0,0 @@
1
- /**
2
- * Quantum Platform API
3
- * Part of the OpenAPI specification for the Quantum Platform.
4
- *
5
- * The version of the OpenAPI document: v1
6
- * Contact: info@anaqor.io
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import * as runtime from '../runtime.js';
13
- import type { MonthAmountDto } from '../models/index.js';
14
- export interface GetCostsByMonthRequest {
15
- year: number;
16
- month: number;
17
- xOrganizationId?: string;
18
- }
19
- export interface GetRevenueByMonthRequest {
20
- year: number;
21
- month: number;
22
- xOrganizationId?: string;
23
- }
24
- /**
25
- *
26
- */
27
- export declare class ServicePlatformDashboardApi extends runtime.BaseAPI {
28
- /**
29
- * Returns the cost report for a given month.
30
- */
31
- getCostsByMonthRaw(requestParameters: GetCostsByMonthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MonthAmountDto>>;
32
- /**
33
- * Returns the cost report for a given month.
34
- */
35
- getCostsByMonth(requestParameters: GetCostsByMonthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MonthAmountDto>;
36
- /**
37
- * Returns the revenue report for a given month.
38
- */
39
- getRevenueByMonthRaw(requestParameters: GetRevenueByMonthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MonthAmountDto>>;
40
- /**
41
- * Returns the revenue report for a given month.
42
- */
43
- getRevenueByMonth(requestParameters: GetRevenueByMonthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MonthAmountDto>;
44
- }