@openshift-migration-advisor/agent-sdk 0.24.0 → 0.27.0-c0cec331350f

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.
@@ -13,6 +13,11 @@
13
13
  */
14
14
 
15
15
  import * as runtime from '../runtime.js';
16
+ import {
17
+ type ApplicationListResponse,
18
+ ApplicationListResponseFromJSON,
19
+ ApplicationListResponseToJSON,
20
+ } from '../models/ApplicationListResponse.js';
16
21
  import {
17
22
  type CreateGroupRequest,
18
23
  CreateGroupRequestFromJSON,
@@ -95,6 +100,13 @@ export interface GetLatestGroupRequest {
95
100
  pageSize?: number;
96
101
  }
97
102
 
103
+ export interface ListGroupApplicationsRequest {
104
+ /**
105
+ * Group ID
106
+ */
107
+ groupId: string;
108
+ }
109
+
98
110
  export interface ListGroupsRequest {
99
111
  /**
100
112
  * Collection ID
@@ -253,6 +265,29 @@ export interface GroupsApiInterface {
253
265
  */
254
266
  getLatestGroup(requestParameters: GetLatestGroupRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GroupResponse>;
255
267
 
268
+ /**
269
+ * Creates request options for listGroupApplications without sending the request
270
+ * @param {string} groupId Group ID
271
+ * @throws {RequiredError}
272
+ * @memberof GroupsApiInterface
273
+ */
274
+ listGroupApplicationsRequestOpts(requestParameters: ListGroupApplicationsRequest): Promise<runtime.RequestOpts>;
275
+
276
+ /**
277
+ *
278
+ * @summary List detected applications for a group
279
+ * @param {string} groupId Group ID
280
+ * @param {*} [options] Override http request option.
281
+ * @throws {RequiredError}
282
+ * @memberof GroupsApiInterface
283
+ */
284
+ listGroupApplicationsRaw(requestParameters: ListGroupApplicationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationListResponse>>;
285
+
286
+ /**
287
+ * List detected applications for a group
288
+ */
289
+ listGroupApplications(requestParameters: ListGroupApplicationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationListResponse>;
290
+
256
291
  /**
257
292
  * Creates request options for listGroups without sending the request
258
293
  * @param {string} id Collection ID
@@ -554,6 +589,51 @@ export class GroupsApi extends runtime.BaseAPI implements GroupsApiInterface {
554
589
  return await response.value();
555
590
  }
556
591
 
592
+ /**
593
+ * Creates request options for listGroupApplications without sending the request
594
+ */
595
+ async listGroupApplicationsRequestOpts(requestParameters: ListGroupApplicationsRequest): Promise<runtime.RequestOpts> {
596
+ if (requestParameters['groupId'] == null) {
597
+ throw new runtime.RequiredError(
598
+ 'groupId',
599
+ 'Required parameter "groupId" was null or undefined when calling listGroupApplications().'
600
+ );
601
+ }
602
+
603
+ const queryParameters: any = {};
604
+
605
+ const headerParameters: runtime.HTTPHeaders = {};
606
+
607
+
608
+ let urlPath = `/groups/{groupId}/applications`;
609
+ urlPath = urlPath.replace('{groupId}', encodeURIComponent(String(requestParameters['groupId'])));
610
+
611
+ return {
612
+ path: urlPath,
613
+ method: 'GET',
614
+ headers: headerParameters,
615
+ query: queryParameters,
616
+ };
617
+ }
618
+
619
+ /**
620
+ * List detected applications for a group
621
+ */
622
+ async listGroupApplicationsRaw(requestParameters: ListGroupApplicationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationListResponse>> {
623
+ const requestOptions = await this.listGroupApplicationsRequestOpts(requestParameters);
624
+ const response = await this.request(requestOptions, initOverrides);
625
+
626
+ return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationListResponseFromJSON(jsonValue));
627
+ }
628
+
629
+ /**
630
+ * List detected applications for a group
631
+ */
632
+ async listGroupApplications(requestParameters: ListGroupApplicationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationListResponse> {
633
+ const response = await this.listGroupApplicationsRaw(requestParameters, initOverrides);
634
+ return await response.value();
635
+ }
636
+
557
637
  /**
558
638
  * Creates request options for listGroups without sending the request
559
639
  */
@@ -31,6 +31,14 @@ export interface Datastore {
31
31
  *
32
32
  */
33
33
  type: string;
34
+ /**
35
+ * Storage access category derived from Datastore.Type
36
+ */
37
+ storageProtocol?: DatastoreStorageProtocolEnum;
38
+ /**
39
+ * Whether this datastore supports vSAN point-in-time snapshots
40
+ */
41
+ vsanSnapshotSupport?: boolean;
34
42
  /**
35
43
  *
36
44
  */
@@ -69,6 +77,18 @@ export interface Datastore {
69
77
  storageIoConfiguration?: StorageIoConfiguration;
70
78
  }
71
79
 
80
+
81
+ /**
82
+ * @export
83
+ */
84
+ export const DatastoreStorageProtocolEnum = {
85
+ Block: 'Block',
86
+ File: 'File',
87
+ Object: 'Object',
88
+ } as const;
89
+ export type DatastoreStorageProtocolEnum = typeof DatastoreStorageProtocolEnum[keyof typeof DatastoreStorageProtocolEnum];
90
+
91
+
72
92
  /**
73
93
  * Check if a given object implements the Datastore interface.
74
94
  */
@@ -95,6 +115,8 @@ export function DatastoreFromJSONTyped(json: any, ignoreDiscriminator: boolean):
95
115
  return {
96
116
 
97
117
  'type': json['type'],
118
+ 'storageProtocol': json['storageProtocol'] == null ? undefined : json['storageProtocol'],
119
+ 'vsanSnapshotSupport': json['vsanSnapshotSupport'] == null ? undefined : json['vsanSnapshotSupport'],
98
120
  'totalCapacityGB': json['totalCapacityGB'],
99
121
  'freeCapacityGB': json['freeCapacityGB'],
100
122
  'vendor': json['vendor'],
@@ -119,6 +141,8 @@ export function DatastoreToJSONTyped(value?: Datastore | null, ignoreDiscriminat
119
141
  return {
120
142
 
121
143
  'type': value['type'],
144
+ 'storageProtocol': value['storageProtocol'],
145
+ 'vsanSnapshotSupport': value['vsanSnapshotSupport'],
122
146
  'totalCapacityGB': value['totalCapacityGB'],
123
147
  'freeCapacityGB': value['freeCapacityGB'],
124
148
  'vendor': value['vendor'],
@@ -45,6 +45,10 @@ export interface Infra {
45
45
  *
46
46
  */
47
47
  totalHosts: number;
48
+ /**
49
+ * Whether any hosts run without vCenter cluster management (not part of any cluster)
50
+ */
51
+ standaloneHostsDetected?: boolean;
48
52
  /**
49
53
  *
50
54
  */
@@ -120,6 +124,7 @@ export function InfraFromJSONTyped(json: any, ignoreDiscriminator: boolean): Inf
120
124
  return {
121
125
 
122
126
  'totalHosts': json['totalHosts'],
127
+ 'standaloneHostsDetected': json['standaloneHostsDetected'] == null ? undefined : json['standaloneHostsDetected'],
123
128
  'totalDatacenters': json['totalDatacenters'] == null ? undefined : json['totalDatacenters'],
124
129
  'totalClusters': json['totalClusters'] == null ? undefined : json['totalClusters'],
125
130
  'clustersPerDatacenter': json['clustersPerDatacenter'] == null ? undefined : json['clustersPerDatacenter'],
@@ -147,6 +152,7 @@ export function InfraToJSONTyped(value?: Infra | null, ignoreDiscriminator: bool
147
152
  return {
148
153
 
149
154
  'totalHosts': value['totalHosts'],
155
+ 'standaloneHostsDetected': value['standaloneHostsDetected'],
150
156
  'totalDatacenters': value['totalDatacenters'],
151
157
  'totalClusters': value['totalClusters'],
152
158
  'clustersPerDatacenter': value['clustersPerDatacenter'],
package/src/runtime.ts CHANGED
@@ -488,14 +488,81 @@ export class VoidApiResponse {
488
488
  }
489
489
  }
490
490
 
491
+ /**
492
+ * A Blob carrying the file name the server advertised, empty when it did not send one. It is a File
493
+ * wherever one can be built, and the bare Blob given a name otherwise. Same name and shape as the
494
+ * `typescript` generator's browser HttpFile.
495
+ */
496
+ export type HttpFile = Blob & { readonly name: string };
497
+
491
498
  export class BlobApiResponse {
492
499
  constructor(public raw: Response) {}
493
500
 
494
- async value(): Promise<Blob> {
495
- return await this.raw.blob();
501
+ /**
502
+ * The body named after the Content-Disposition header, so that a download keeps the name the
503
+ * server gave it. A File is built from a native Blob; the Blob itself is named where there is no
504
+ * global File (Node.js before 20), where File cannot be constructed, or where the Blob is not the
505
+ * native one, as returned by an injected fetch implementation such as node-fetch, which a File
506
+ * would stringify instead of wrapping.
507
+ */
508
+ async value(): Promise<HttpFile> {
509
+ const blob = await this.raw.blob();
510
+ const name = parseContentDispositionFilename(this.raw.headers) ?? '';
511
+ if (typeof File !== 'undefined' && blob instanceof Blob) {
512
+ try {
513
+ return new File([blob], name, { type: blob.type });
514
+ } catch {
515
+ // File cannot be constructed: name the Blob itself
516
+ }
517
+ }
518
+ return Object.assign(blob, { name });
496
519
  };
497
520
  }
498
521
 
522
+ /**
523
+ * The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
524
+ * `filename*` parameter first, falling back to the plain `filename` when it is malformed, not UTF-8
525
+ * or has no usable name. Any directory part is dropped; undefined when no usable name is advertised.
526
+ */
527
+ export function parseContentDispositionFilename(headers: Headers): string | undefined {
528
+ const params = parseHeaderParameters(headers.get('Content-Disposition') ?? '');
529
+ return basename(decodeExtValue(params.get('filename*'))) ?? basename(params.get('filename'));
530
+ }
531
+
532
+ /** The decoded RFC 5987 ext-value, or undefined when it is not UTF-8 or its percent-encoding is malformed. */
533
+ function decodeExtValue(value: string | undefined): string | undefined {
534
+ const match = value === undefined ? null : /^utf-8'[^']*'(.*)$/i.exec(value);
535
+ try {
536
+ return match ? decodeURIComponent(match[1]) : undefined;
537
+ } catch {
538
+ return undefined;
539
+ }
540
+ }
541
+
542
+ /**
543
+ * The `name=value` parameters of a header value, consumed one at a time so that a quoted-string is
544
+ * taken whole, `;` included. Names are lower-cased, quoted-string values are unquoted with their
545
+ * backslash escapes resolved, and the first occurrence of a name wins.
546
+ */
547
+ function parseHeaderParameters(value: string): Map<string, string> {
548
+ const params = new Map<string, string>();
549
+ const parameter = /(?:^|;)\s*([^=;]+?)\s*=\s*(?:"((?:[^"\\]|\\.)*)"?|([^;]*))/g;
550
+ let match: RegExpExecArray | null;
551
+ while ((match = parameter.exec(value)) !== null) {
552
+ const name = match[1].toLowerCase();
553
+ if (!params.has(name)) {
554
+ params.set(name, match[2] !== undefined ? match[2].replace(/\\(.)/g, '$1') : match[3].trim());
555
+ }
556
+ }
557
+ return params;
558
+ }
559
+
560
+ /** The last `/` or `\` separated segment of a file name, or undefined when it is not a file name. */
561
+ function basename(name: string | undefined): string | undefined {
562
+ const base = name?.split(/[\\/]/).pop();
563
+ return !base || base === '.' || base === '..' ? undefined : base;
564
+ }
565
+
499
566
  export class TextApiResponse {
500
567
  constructor(public raw: Response) {}
501
568