@vcd/sdk 0.13.0 → 15.0.0-alpha.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 (92) hide show
  1. package/client/client/api.result.service.d.ts +20 -0
  2. package/client/client/constants.d.ts +10 -0
  3. package/client/client/index.d.ts +7 -0
  4. package/client/client/logging.interceptor.d.ts +14 -0
  5. package/client/client/request.headers.interceptor.d.ts +20 -0
  6. package/client/client/response.normalization.interceptor.d.ts +39 -0
  7. package/client/client/vcd.api.client.d.ts +351 -0
  8. package/client/client/vcd.http.client.d.ts +32 -0
  9. package/client/client/vcd.transfer.client.d.ts +121 -0
  10. package/client/container-hooks/index.d.ts +58 -0
  11. package/client/index.d.ts +2 -0
  12. package/client/openapi.d.ts +76 -0
  13. package/client/query/filter.builder.d.ts +162 -0
  14. package/client/query/index.d.ts +2 -0
  15. package/client/query/query.builder.d.ts +30 -0
  16. package/common/container-hooks.d.ts +2 -2
  17. package/core/plugin.module.d.ts +10 -5
  18. package/esm2020/client/client/api.result.service.mjs +43 -0
  19. package/esm2020/client/client/constants.mjs +13 -0
  20. package/esm2020/client/client/index.mjs +8 -0
  21. package/esm2020/client/client/logging.interceptor.mjs +44 -0
  22. package/esm2020/client/client/request.headers.interceptor.mjs +91 -0
  23. package/esm2020/client/client/response.normalization.interceptor.mjs +59 -0
  24. package/esm2020/client/client/vcd.api.client.mjs +602 -0
  25. package/esm2020/client/client/vcd.http.client.mjs +52 -0
  26. package/esm2020/client/client/vcd.transfer.client.mjs +166 -0
  27. package/esm2020/client/container-hooks/index.mjs +57 -0
  28. package/esm2020/client/index.mjs +3 -0
  29. package/esm2020/client/openapi.mjs +16 -0
  30. package/esm2020/client/query/filter.builder.mjs +195 -0
  31. package/esm2020/client/query/index.mjs +3 -0
  32. package/esm2020/client/query/query.builder.mjs +79 -0
  33. package/esm2020/common/container-hooks.mjs +74 -0
  34. package/esm2020/common/index.mjs +2 -0
  35. package/esm2020/core/index.mjs +2 -0
  36. package/esm2020/core/plugin.module.mjs +18 -0
  37. package/esm2020/main.mjs +45 -0
  38. package/esm2020/public-api.mjs +8 -0
  39. package/esm2020/vcd-sdk.mjs +5 -0
  40. package/fesm2015/vcd-sdk.mjs +1513 -0
  41. package/fesm2015/vcd-sdk.mjs.map +1 -0
  42. package/fesm2020/vcd-sdk.mjs +1508 -0
  43. package/fesm2020/vcd-sdk.mjs.map +1 -0
  44. package/index.d.ts +5 -0
  45. package/main.d.ts +11 -5
  46. package/package.json +30 -39
  47. package/public-api.d.ts +1 -1
  48. package/vcd-sdk-15.0.0-alpha.0.tgz +0 -0
  49. package/LICENSE.txt +0 -12
  50. package/README.md +0 -119
  51. package/bundles/vcd-sdk.umd.js +0 -810
  52. package/bundles/vcd-sdk.umd.js.map +0 -1
  53. package/bundles/vcd-sdk.umd.min.js +0 -16
  54. package/bundles/vcd-sdk.umd.min.js.map +0 -1
  55. package/esm2015/common/container-hooks.js +0 -219
  56. package/esm2015/common/index.js +0 -6
  57. package/esm2015/core/index.js +0 -6
  58. package/esm2015/core/plugin.module.js +0 -53
  59. package/esm2015/i18n/index.js +0 -8
  60. package/esm2015/i18n/translate.pipe.js +0 -92
  61. package/esm2015/i18n/translate.service.js +0 -229
  62. package/esm2015/i18n/translation.loader.js +0 -63
  63. package/esm2015/main.js +0 -37
  64. package/esm2015/public-api.js +0 -12
  65. package/esm2015/vcd-sdk.js +0 -10
  66. package/esm5/common/container-hooks.js +0 -266
  67. package/esm5/common/index.js +0 -6
  68. package/esm5/core/index.js +0 -6
  69. package/esm5/core/plugin.module.js +0 -64
  70. package/esm5/i18n/index.js +0 -8
  71. package/esm5/i18n/translate.pipe.js +0 -108
  72. package/esm5/i18n/translate.service.js +0 -280
  73. package/esm5/i18n/translation.loader.js +0 -68
  74. package/esm5/main.js +0 -41
  75. package/esm5/public-api.js +0 -12
  76. package/esm5/vcd-sdk.js +0 -10
  77. package/fesm2015/vcd-sdk.js +0 -511
  78. package/fesm2015/vcd-sdk.js.map +0 -1
  79. package/fesm5/vcd-sdk.js +0 -620
  80. package/fesm5/vcd-sdk.js.map +0 -1
  81. package/i18n/index.d.ts +0 -3
  82. package/i18n/translate.pipe.d.ts +0 -12
  83. package/i18n/translate.service.d.ts +0 -21
  84. package/i18n/translation.loader.d.ts +0 -11
  85. package/schematics/collection.json +0 -10
  86. package/schematics/ng-add/index.d.ts +0 -3
  87. package/schematics/ng-add/index.js +0 -101
  88. package/schematics/ng-add/index.ts +0 -134
  89. package/schematics/ng-add/schema.d.ts +0 -8
  90. package/schematics/ng-add/schema.json +0 -19
  91. package/vcd-sdk.d.ts +0 -5
  92. package/vcd-sdk.metadata.json +0 -1
@@ -0,0 +1,20 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ApiResultService {
3
+ private _results;
4
+ get results(): ApiResult[];
5
+ add(result: ApiResult): void;
6
+ clear(): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApiResultService, never>;
8
+ static ɵprov: i0.ɵɵInjectableDeclaration<ApiResultService>;
9
+ }
10
+ export declare class ApiResult {
11
+ private _message;
12
+ get message(): string;
13
+ private _succeeded;
14
+ get succeeded(): boolean;
15
+ private _started;
16
+ get started(): Date;
17
+ private _finished;
18
+ get finished(): Date;
19
+ constructor(message: string, succeeded: boolean, started: Date, finished: Date);
20
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * HTTP Headers
3
+ */
4
+ export declare const HTTP_HEADERS: Readonly<{
5
+ Authorization: "Authorization";
6
+ etag: "etag";
7
+ link: "link";
8
+ Link: "Link";
9
+ x_vcloud_authorization: "x-vcloud-authorization";
10
+ }>;
@@ -0,0 +1,7 @@
1
+ export * from './api.result.service';
2
+ export * from './vcd.http.client';
3
+ export * from './vcd.api.client';
4
+ export * from './vcd.transfer.client';
5
+ export * from './request.headers.interceptor';
6
+ export * from './logging.interceptor';
7
+ export * from './response.normalization.interceptor';
@@ -0,0 +1,14 @@
1
+ import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { ApiResultService } from './api.result.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class LoggingInterceptor implements HttpInterceptor {
6
+ private apiResultService;
7
+ private _outputToConsole;
8
+ private _enabled;
9
+ set enabled(enabled: boolean);
10
+ constructor(apiResultService: ApiResultService);
11
+ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<LoggingInterceptor, [{ optional: true; }]>;
13
+ static ɵprov: i0.ɵɵInjectableDeclaration<LoggingInterceptor>;
14
+ }
@@ -0,0 +1,20 @@
1
+ import { HttpHandler, HttpInterceptor, HttpRequest, HttpEvent } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
4
+ export declare class RequestHeadersInterceptor implements HttpInterceptor {
5
+ private _enabled;
6
+ set enabled(_enabled: boolean);
7
+ private _actAs;
8
+ set actAs(_actAs: string);
9
+ private _version;
10
+ get version(): string;
11
+ set version(_version: string);
12
+ private _authenticationHeader;
13
+ private _authentication;
14
+ set authentication(_authentication: string);
15
+ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
16
+ private setAcceptHeader;
17
+ private setContentTypeHeader;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<RequestHeadersInterceptor, never>;
19
+ static ɵprov: i0.ɵɵInjectableDeclaration<RequestHeadersInterceptor>;
20
+ }
@@ -0,0 +1,39 @@
1
+ import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * An interceptor on the response chain that normalizes differences in
6
+ * JSON payloads between vCloud Director version 9.1 and versions
7
+ * greater than 9.1.
8
+ *
9
+ * In 9.1 (API version 30.0) the server serializes JSON and nests the payload in a value field:
10
+ * ```
11
+ {
12
+ "name" : "{http://www.vmware.com/vcloud/versions}SupportedVersions",
13
+ "declaredType" : "com.vmware.vcloud.api.rest.schema.versioning.SupportedVersionsType",
14
+ "scope" : "javax.xml.bind.JAXBElement$GlobalScope",
15
+ "value" : {
16
+ "versionInfo" : [],
17
+ "any" : [],
18
+ "otherAttributes" : {}
19
+ }
20
+ }
21
+ ```
22
+ *
23
+ * That same request in API versions 31.0 and above is represented as:
24
+ * ```
25
+ {
26
+ "versionInfo" : [],
27
+ "any" : [],
28
+ "otherAttributes" : {}
29
+ }
30
+ ```
31
+ * This interceptor should process responses before any other interceptors that rely
32
+ * on consistent API information.
33
+ */
34
+ export declare class ResponseNormalizationInterceptor implements HttpInterceptor {
35
+ private static readonly QUERY_RESULT_TYPE;
36
+ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<ResponseNormalizationInterceptor, never>;
38
+ static ɵprov: i0.ɵɵInjectableDeclaration<ResponseNormalizationInterceptor>;
39
+ }
@@ -0,0 +1,351 @@
1
+ import { Injector } from '@angular/core';
2
+ import { HttpHeaders } from '@angular/common/http';
3
+ import { Observable } from 'rxjs';
4
+ import { SessionType, AuthorizedLocationType, ResourceType, LinkType, EntityReferenceType, TaskType } from '@vcd/bindings/vcloud/api/rest/schema_v1_5';
5
+ import { AccessibleLocation, Session } from '../openapi';
6
+ import { Query } from '../query/index';
7
+ import { VcdHttpClient } from './vcd.http.client';
8
+ import { VcdTransferClient } from './vcd.transfer.client';
9
+ import { VcdSdkConfig } from "../../core/plugin.module";
10
+ import * as i0 from "@angular/core";
11
+ export declare const TRANSFER_LINK_REL = "upload:default";
12
+ export type Navigable = ResourceType | {
13
+ link?: LinkType[];
14
+ };
15
+ export declare const HATEOAS_HEADER = "Link";
16
+ /**
17
+ * Parse out Link headers using a very lazily implemented pull parser
18
+ * @param header '<url1>;name1="value1",name2="value2",<url2>;name3="value3,value4"'
19
+ * @returns parsed link headers
20
+ */
21
+ export declare function parseHeaderHateoasLinks(header: string): LinkType[];
22
+ export declare enum LinkRelType {
23
+ add = "add",
24
+ remove = "remove",
25
+ edit = "edit"
26
+ }
27
+ /**
28
+ * A basic client for interacting with the VMware Cloud Director APIs.
29
+ *
30
+ * A VMware Cloud Director plugin can get a reference to this client by using angular injection.
31
+ * ```
32
+ * constructor(private vcdApi: VcdApiClient) {}
33
+ * ```
34
+ *
35
+ * VcdApiClient reuses the authentication from the VCD platform so in general there is
36
+ * no need of an explicit authentication/login.
37
+ *
38
+ * When dealing with the session management there are two APIs:
39
+ * 1. Deprecated legacy API that is using the `api/session` endpoint and the corresponding models
40
+ * 2. Newly added API that is using the `cloudapi` endpoint and the corresponding models
41
+ *
42
+ * Note that if a plugin performs an explicit cloud api authentication call through
43
+ * {@link VcdApiClient#setCloudApiAuthentication} or {@link VcdApiClient#cloudApiLogin}
44
+ * from that moment on the VcdApiClient uses only cloud api session management.
45
+ * This means calls to {@link VcdApiClient#setAuthentication} or {@link VcdApiClient#login} have no effect.
46
+ */
47
+ export declare class VcdApiClient {
48
+ private http;
49
+ private injector;
50
+ private config?;
51
+ set baseUrl(_baseUrl: string);
52
+ get version(): string;
53
+ private _negotiateVersion;
54
+ private _baseUrl;
55
+ /**
56
+ * @deprecated Use {@link VcdApiClient#_cloudApiSession}
57
+ */
58
+ private _session;
59
+ private _sessionObservable;
60
+ private _getSession;
61
+ /**
62
+ * CloudApi Session
63
+ */
64
+ private _cloudApiSession;
65
+ private _cloudApiSessionObservable;
66
+ /**
67
+ * This observable has a special purpose when doing automatic login during the constructor initialization.
68
+ * It allows backend call only after an API version is set.
69
+ * It also ensures that a backend call to get the current session is done once prior to any other calls.
70
+ *
71
+ * In case of an explicit cloud api auth request there is no need of this observable
72
+ * since this auth request will retrieve the session itself
73
+ */
74
+ private _getCloudApiSession;
75
+ private _cloudApiSessionLinks;
76
+ /**
77
+ * Cached, lazy loaded observable of the AccessibleLocation array
78
+ */
79
+ private _cloudApiAccessibleLocations;
80
+ /**
81
+ * This property determines if it is an explicit cloud api login.
82
+ * In this case the old API (/api/session) should not be used at all.
83
+ */
84
+ private _isCloudApiLogin;
85
+ constructor(http: VcdHttpClient, injector: Injector, config?: VcdSdkConfig);
86
+ private negotiateVersion;
87
+ /**
88
+ * The purpose of this function is to ensure that prior to sending any call to the backend
89
+ * the version has been set and the current session has been retrieved.
90
+ * Note that this is important during the automatic authentication that is done during the
91
+ * constructor initialization, when the plugin is not required to perform its own explicit authentication
92
+ * but rather the ones from the underlying framework is used.
93
+ */
94
+ private validateRequestContext;
95
+ /**
96
+ *
97
+ * For use cases wich solely depends on cloudapi without any backward compatibility
98
+ * there should be no dependence on the old /api endpoint at all
99
+ */
100
+ private validateRequestContextCloudApiOnly;
101
+ setVersion(_version: string): VcdApiClient;
102
+ /**
103
+ * Global configuration for the service, that allows a provider user to execute API requests
104
+ * in the scope of a specific tenant.
105
+ *
106
+ * If you want to execute single API request in scope of specific tenant you can do it
107
+ * by passing "X-VMWARE-VCLOUD-TENANT-CONTEXT" header to the specific API Request.
108
+ *
109
+ * This scoping is available to query-based API calls and to bulk GET calls in the
110
+ * /cloudapi space.
111
+ *
112
+ * @param actAs an entityRef of the tenant (organization) to scope subsequent calls to in
113
+ * the VcdApiClient, or null/no parameter to remove tenant-specific scoping
114
+ * @returns the current VcdApiClient instance (for chaining)
115
+ */
116
+ actAs(actAs?: EntityReferenceType): VcdApiClient;
117
+ /**
118
+ * @deprecated Use {@link VcdApiClient#setCloudApiAuthentication}
119
+ *
120
+ * Sets the authentication token to use for the VcdApiClient.
121
+ *
122
+ * After setting the token, the client will get the current session
123
+ * information associated with the authenticated token.
124
+ *
125
+ * @param authentication the authentication string (to be used in either the 'Authorization'
126
+ * or 'x-vcloud-authorization' header)
127
+ * @returns the session associated with the authentication token
128
+ */
129
+ setAuthentication(authentication: string): Observable<SessionType>;
130
+ /**
131
+ * Sets the authentication token to use for the VcdApiClient.
132
+ *
133
+ * After setting the token, the client will get the current session
134
+ * information associated with the authenticated token.
135
+ *
136
+ * @param authentication the authentication string (to be used in either the 'Authorization'
137
+ * or 'x-vcloud-authorization' header)
138
+ *
139
+ * @returns session observable associated with the authentication token
140
+ */
141
+ setCloudApiAuthentication(authentication: string): Observable<Session>;
142
+ enableLogging(): VcdApiClient;
143
+ /**
144
+ * @deprecated Use {@link VcdApiClient#cloudApiLogin}
145
+ *
146
+ * Creates an authenticated session for the specified credential data.
147
+ *
148
+ * @param username the name of the user to authenticate
149
+ * @param tenant the organization the user belongs to
150
+ * @param password the password for the user
151
+ * @returns an authenticated session for the given credentials
152
+ */
153
+ login(username: string, tenant: string, password: string): Observable<SessionType>;
154
+ /**
155
+ * Creates an authenticated session for the specified credential data using cloud api endpoint.
156
+ *
157
+ * @param username the name of the user to authenticate
158
+ * @param tenant the organization the user belongs to
159
+ * @param password the password for the user
160
+ * @returns an authenticated session for the given credentials
161
+ */
162
+ cloudApiLogin(username: string, tenant: string, password: string): Observable<Session>;
163
+ /**
164
+ * It is necessary to know if an explicit cloud api auth request was done.
165
+ * This function handles this by setting the corresponding flags, properties etc.
166
+ */
167
+ private onBeforeCloudApiAuthentication;
168
+ /**
169
+ * Handle authentication.
170
+ * This includes getting HATEOAS links, setting the session, handling errors etc.
171
+ */
172
+ private onCloudApiAuthentication;
173
+ private onCloudApiAuthenticationError;
174
+ private setCloudApiSessionLinks;
175
+ get<T>(endpoint: string, options?: {
176
+ headers?: HttpHeaders;
177
+ }): Observable<T>;
178
+ list<T>(endpoint: string, queryBuilder?: Query.Builder, multisite?: boolean | AuthorizedLocationType[], options?: {
179
+ headers?: HttpHeaders;
180
+ }): Observable<T>;
181
+ createSync<T>(endpoint: string, item: T, options?: {
182
+ headers?: HttpHeaders;
183
+ }): Observable<T>;
184
+ createAsync<T>(endpoint: string, item: T, options?: {
185
+ headers?: HttpHeaders;
186
+ }): Observable<TaskType>;
187
+ getTransferLink<T>(endpoint: string, item: T, transferRel?: string): Observable<string>;
188
+ startTransfer<T>(endpoint: string, item: T, transferRel?: string): Observable<VcdTransferClient>;
189
+ updateSync<T>(endpoint: string, item: T, options?: {
190
+ headers?: HttpHeaders;
191
+ }): Observable<T>;
192
+ updateAsync<T>(endpoint: string, item: T, options?: {
193
+ headers?: HttpHeaders;
194
+ }): Observable<TaskType>;
195
+ deleteSync(endpoint: string, options?: {
196
+ headers?: HttpHeaders;
197
+ }): Observable<void>;
198
+ deleteAsync(endpoint: string, options?: {
199
+ headers?: HttpHeaders;
200
+ }): Observable<TaskType>;
201
+ private mapResponseToTask;
202
+ getEntity<T extends EntityReferenceType>(entityRef: EntityReferenceType): Observable<T>;
203
+ getEntity<T extends EntityReferenceType>(urn: string): Observable<T>;
204
+ updateTask(task: TaskType, options?: {
205
+ headers?: HttpHeaders;
206
+ }): Observable<TaskType>;
207
+ isTaskComplete(task: TaskType): boolean;
208
+ removeItem(item: Navigable, options?: {
209
+ headers?: HttpHeaders;
210
+ }): Observable<TaskType>;
211
+ /**
212
+ * Queries the VMware Cloud Director API based on the specified Query.Builder instance.
213
+ *
214
+ * @param builder An definition of the query to construct (type, filter, page size, etc.)
215
+ * @param multisite a flag indicating whether or not to fan the query out to all available sites
216
+ * @returns a query result for the specified query
217
+ */
218
+ query<T>(builder: Query.Builder, multisite?: boolean, options?: {
219
+ headers?: HttpHeaders;
220
+ }): Observable<T>;
221
+ /**
222
+ * Queries the VMware Cloud Director API based on the specified Query.Builder instance.
223
+ *
224
+ * @param builder An definition of the query to construct (type, filter, page size, etc.)
225
+ * @param multisite the set of site locations to include in the query fanout
226
+ * @returns a query result for the specified query
227
+ */
228
+ query<T>(builder: Query.Builder, multisite?: AuthorizedLocationType[], options?: {
229
+ headers?: HttpHeaders;
230
+ }): Observable<T>;
231
+ /**
232
+ * Queries the VMware Cloud Director API for the first page of the provided result set.
233
+ *
234
+ * @param result the result set to retrieve the first page of records for
235
+ * @param multisite a flag indicating whether or not to fan the query out to all available sites
236
+ * @returns the records for the first page of the query
237
+ */
238
+ firstPage<T>(result: T, multisite?: boolean, options?: {
239
+ headers?: HttpHeaders;
240
+ }): Observable<T>;
241
+ /**
242
+ * Queries the VMware Cloud Director API for the first page of the provided result set.
243
+ *
244
+ * @param result the result set to retrieve the first page of records for
245
+ * @param multisite the set of site locations to include in the query fanout
246
+ * @returns the records for the first page of the query
247
+ */
248
+ firstPage<T>(result: T, multisite?: AuthorizedLocationType[], options?: {
249
+ headers?: HttpHeaders;
250
+ }): Observable<T>;
251
+ hasFirstPage<T>(result: T): boolean;
252
+ /**
253
+ * Queries the VMware Cloud Director API for the previous page of the provided result set.
254
+ *
255
+ * @param result the result set to retrieve the previous page of records for
256
+ * @param multisite a flag indicating whether or not to fan the query out to all available sites
257
+ * @returns the records for the previous page of the query
258
+ */
259
+ previousPage<T>(result: T, multisite?: boolean, options?: {
260
+ headers?: HttpHeaders;
261
+ }): Observable<T>;
262
+ /**
263
+ * Queries the VMware Cloud Director API for the previous page of the provided result set.
264
+ *
265
+ * @param result the result set to retrieve the previous page of records for
266
+ * @param multisite the set of site locations to include in the query fanout
267
+ * @returns the records for the previous page of the query
268
+ */
269
+ previousPage<T>(result: T, multisite?: AuthorizedLocationType[], options?: {
270
+ headers?: HttpHeaders;
271
+ }): Observable<T>;
272
+ hasPreviousPage<T>(result: T): boolean;
273
+ /**
274
+ * Queries the VMware Cloud Director API for the next page of the provided result set.
275
+ *
276
+ * @param result the result set to retrieve the next page of records for
277
+ * @param multisite a flag indicating whether or not to fan the query out to all available sites
278
+ * @returns the records for the next page of the query
279
+ */
280
+ nextPage<T>(result: T, multisite?: boolean, options?: {
281
+ headers?: HttpHeaders;
282
+ }): Observable<T>;
283
+ /**
284
+ * Queries the VMware Cloud Director API for the next page of the provided result set.
285
+ *
286
+ * @param result the result set to retrieve the next page of records for
287
+ * @param multisite the set of site locations to include in the query fanout
288
+ * @returns the records for the next page of the query
289
+ */
290
+ nextPage<T>(result: T, multisite?: AuthorizedLocationType[], options?: {
291
+ headers?: HttpHeaders;
292
+ }): Observable<T>;
293
+ hasNextPage<T>(result: T): boolean;
294
+ /**
295
+ * Queries the VMware Cloud Director API for the last page of the provided result set.
296
+ *
297
+ * @param result the result set to retrieve the last page of records for
298
+ * @param multisite a flag indicating whether or not to fan the query out to all available sites
299
+ * @returns the records for the last page of the query
300
+ */
301
+ lastPage<T>(result: T, multisite?: boolean, options?: {
302
+ headers?: HttpHeaders;
303
+ }): Observable<T>;
304
+ /**
305
+ * Queries the VMware Cloud Director API for the last page of the provided result set.
306
+ *
307
+ * @param result the result set to retrieve the last page of records for
308
+ * @param multisite the set of site locations to include in the query fanout
309
+ * @returns the records for the last page of the query
310
+ */
311
+ lastPage<T>(result: T, multisite?: AuthorizedLocationType[], options?: {
312
+ headers?: HttpHeaders;
313
+ }): Observable<T>;
314
+ hasLastPage<T>(result: T): boolean;
315
+ private getQueryPage;
316
+ /**
317
+ * Use to perform action availability check before calling the API
318
+ * @param item - the navigable item (containing link collection)
319
+ * @param linkRelType - the link rel type, pass either LinkRelType or string
320
+ * @param entityRefType - the entity reference type
321
+ */
322
+ canPerformAction(item: Navigable, linkRelType: LinkRelType | string, entityRefType?: string): boolean;
323
+ private findLink;
324
+ private parseMultisiteValue;
325
+ /**
326
+ * @deprecated Use cloudApiSession
327
+ */
328
+ get session(): Observable<SessionType>;
329
+ /**
330
+ * Get Session observable
331
+ */
332
+ get cloudApiSession(): Observable<Session>;
333
+ get username(): Observable<string>;
334
+ get organization(): Observable<string>;
335
+ /**
336
+ * @deprecated Use cloudApiLocation
337
+ */
338
+ get location(): Observable<AuthorizedLocationType>;
339
+ /**
340
+ * Gets the location corresponding to the current session
341
+ */
342
+ get cloudApiLocation(): Observable<AccessibleLocation>;
343
+ getLocation(session: SessionType): AuthorizedLocationType;
344
+ /**
345
+ * Build the endpoint url. If the provided endpoint is already an absolute URL, then return it as it is without
346
+ * any modifications, otherwise consider it as a relative one and prepend the baseUrl as defined by the host application.
347
+ */
348
+ private buildEndpointUrl;
349
+ static ɵfac: i0.ɵɵFactoryDeclaration<VcdApiClient, [null, null, { optional: true; }]>;
350
+ static ɵprov: i0.ɵɵInjectableDeclaration<VcdApiClient>;
351
+ }
@@ -0,0 +1,32 @@
1
+ import { HttpBackend, HttpClient } from '@angular/common/http';
2
+ import { LoggingInterceptor } from './logging.interceptor';
3
+ import { RequestHeadersInterceptor } from './request.headers.interceptor';
4
+ import { ResponseNormalizationInterceptor } from './response.normalization.interceptor';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * This is a specialist subclass of HttpClient. The HttpClient that is defined/imported
8
+ * by HttpClientModule is a singleton from the container, meaning that all extensions would
9
+ * get the same one. We sub-class it so that each extension gets their own instance.
10
+ * Extension consumers should inject this.
11
+ * @see HttpClient
12
+ */
13
+ export declare class VcdHttpClient extends HttpClient {
14
+ /**
15
+ * Provide access to the logging interceptor for enabling/disabling and configuring.
16
+ */
17
+ readonly loggingInterceptor: LoggingInterceptor;
18
+ /**
19
+ * Provide access to the headers interceptor for enabling/disabling and configuring.
20
+ */
21
+ readonly requestHeadersInterceptor: RequestHeadersInterceptor;
22
+ /**
23
+ * Create an HttpClient with the logging and header interceptors in the chain.
24
+ * @param httpBackend backend (likely injected from HttpClientModule)
25
+ * @param hateoasHeaderInterceptor the hateoas header interceptor
26
+ * @param loggingInterceptor the logging interceptor
27
+ * @param requestHeadersInterceptor the request header interceptor
28
+ */
29
+ constructor(httpBackend: HttpBackend, loggingInterceptor: LoggingInterceptor, requestHeadersInterceptor: RequestHeadersInterceptor, responseNormalizationInterceptor: ResponseNormalizationInterceptor);
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<VcdHttpClient, never>;
31
+ static ɵprov: i0.ɵɵInjectableDeclaration<VcdHttpClient>;
32
+ }
@@ -0,0 +1,121 @@
1
+ import { Observable, Observer } from 'rxjs';
2
+ import { VcdHttpClient } from './vcd.http.client';
3
+ /**
4
+ * Default chunk size is 50MiB. This is equal to the chunk size the VCD UI uses for library uploads.
5
+ */
6
+ export declare const MAX_CHUNK_SIZE: number;
7
+ /**
8
+ * How many times to retry a chunk upload.
9
+ */
10
+ export declare const MAX_CHUNK_RETRY_COUNT = 5;
11
+ /**
12
+ * Details about a completed file transfer.
13
+ */
14
+ export interface TransferResult {
15
+ /**
16
+ * Filename being transferred.
17
+ */
18
+ filename: string | '<blob>';
19
+ /**
20
+ * URL being used for the transfer.
21
+ */
22
+ transferUrl: string;
23
+ /**
24
+ * How many retries in total were required
25
+ */
26
+ retryCount: number;
27
+ /**
28
+ * The number of chunks that have been sent.
29
+ */
30
+ chunksSent: number;
31
+ /**
32
+ * How many bytes have been sent.
33
+ */
34
+ bytesSent: number;
35
+ /**
36
+ * How many milliseconds that have elapsed since starting the transfer.
37
+ */
38
+ timeTakenMs: number;
39
+ }
40
+ /**
41
+ * Details about a file transfer in progress.
42
+ */
43
+ export interface TransferProgress {
44
+ /**
45
+ * Filename being transferred.
46
+ */
47
+ filename: string | '<blob>';
48
+ /**
49
+ * URL being used for the transfer.
50
+ */
51
+ transferUrl: string;
52
+ /**
53
+ * The current retry number for the current chunk.
54
+ */
55
+ retryNumber: number;
56
+ /**
57
+ * The number of retries in total.
58
+ */
59
+ retryCount: number;
60
+ /**
61
+ * The number of chunks that have been sent.
62
+ */
63
+ chunksSent: number;
64
+ /**
65
+ * The number of chunks remaining.
66
+ */
67
+ chunksRemaining: number;
68
+ /**
69
+ * How many bytes have been sent.
70
+ */
71
+ bytesSent: number;
72
+ /**
73
+ * How many bytes remaining to be sent.
74
+ */
75
+ bytesRemaining: number;
76
+ /**
77
+ * Percentage completion.
78
+ */
79
+ percent: number;
80
+ /**
81
+ * How many milliseconds that have elapsed since starting the transfer.
82
+ */
83
+ timeTakenMs: number;
84
+ /**
85
+ * Naive estimate of time remaining. This is not scientific at all - a simple linear extrapolation.
86
+ */
87
+ estimatedTimeRemainingMs: number;
88
+ }
89
+ /**
90
+ * A special error thrown by the transfer client. It gives access to the causing error, and the final progress
91
+ * before the error occurred.
92
+ */
93
+ export declare class TransferError extends Error {
94
+ readonly originalError: any;
95
+ readonly lastProgress: TransferProgress;
96
+ constructor(message: string, originalError: any, lastProgress: TransferProgress);
97
+ }
98
+ /**
99
+ * This is used to upload files to a VCD API transfer URL. It is not suggested to create this class - instead
100
+ * use the startTransfer method in VcdApiClient.
101
+ */
102
+ export declare class VcdTransferClient {
103
+ httpClient: VcdHttpClient;
104
+ transferUrl: string;
105
+ maxChunkSize: number;
106
+ maxChunkRetryCount: number;
107
+ /**
108
+ * Create a transfer client.
109
+ * @param httpClient the http client to be used
110
+ * @param transferUrl the URL to upload to
111
+ */
112
+ constructor(httpClient: VcdHttpClient, transferUrl: string, maxChunkSize?: number, maxChunkRetryCount?: number);
113
+ /**
114
+ * Upload data, optionally listening for progress updates.
115
+ * @param source what to upload.
116
+ * @param progressObserver (optional) this will get progress notifications during the upload
117
+ * @returns fetails of the finished upload.
118
+ * @throws TransferError when a chunk upload fails.
119
+ */
120
+ upload(source: Blob | File, progressObserver?: Observer<TransferProgress>): Observable<TransferResult>;
121
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This is the currently supported - albeit very minimal - public SDK.
3
+ */
4
+ import { InjectionToken } from '@angular/core';
5
+ /**
6
+ * Wire in as a string. Gives the root URL for API access (for example, the load balancer URL
7
+ * or the single-cell URL).
8
+ */
9
+ export declare const API_ROOT_URL: InjectionToken<string>;
10
+ /**
11
+ * Wire in as a string. Gives the root URL for the legacy Flex application.
12
+ */
13
+ export declare const FLEX_APP_URL: InjectionToken<string>;
14
+ /**
15
+ * Wire in as a string. Gives the current scope of the VCD-UI. As of current, this will be
16
+ * either 'tenant' for the tenant portal, or 'service-provider' for the service-provider portal.
17
+ */
18
+ export declare const SESSION_SCOPE: InjectionToken<string>;
19
+ /**
20
+ * Wire in as a string. Gives the unique name (not the display name) of the current tenant
21
+ * organization that the VCD-UI is being used for.
22
+ */
23
+ export declare const SESSION_ORGANIZATION: InjectionToken<string>;
24
+ /**
25
+ * Wire in as a string. Gives the UUID identifier of the current tenant
26
+ * organization that the VCD-UI is being used for.
27
+ */
28
+ export declare const SESSION_ORG_ID: InjectionToken<string>;
29
+ /**
30
+ * Wire in as a string. Gives the full root path for module assets (e.g. images, scripts, text files)
31
+ *
32
+ * ATTENTION!
33
+ * Add || new InjectionToken to workaround the Angular security mechanics which prevent use of injection tokens
34
+ * which potentially are not defiend. The same fix can be applied for the rest tokens if needed.
35
+ */
36
+ export declare const EXTENSION_ASSET_URL: InjectionToken<string>;
37
+ /**
38
+ * Wire in as a string. Gives the Angular 2 route that the module is registered under.
39
+ */
40
+ export declare const EXTENSION_ROUTE: InjectionToken<string>;
41
+ /**
42
+ * Wire in as a boolean. True if running under the SDK, false if running in production.
43
+ */
44
+ export declare const SDK_MODE: InjectionToken<boolean>;
45
+ /**
46
+ * Inject this to access the authentication token.
47
+ */
48
+ export interface AuthTokenHolderService {
49
+ /**
50
+ * The authentication token.
51
+ */
52
+ token: string;
53
+ /**
54
+ * JWT token
55
+ */
56
+ jwt?: string;
57
+ }
58
+ export declare const AuthTokenHolderService: AuthTokenHolderService;