@vcd/sdk 0.13.0 → 15.0.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 (91) hide show
  1. package/README.md +3 -118
  2. package/client/client/api.result.service.d.ts +20 -0
  3. package/client/client/constants.d.ts +10 -0
  4. package/client/client/index.d.ts +7 -0
  5. package/client/client/logging.interceptor.d.ts +14 -0
  6. package/client/client/request.headers.interceptor.d.ts +20 -0
  7. package/client/client/response.normalization.interceptor.d.ts +39 -0
  8. package/client/client/vcd.api.client.d.ts +351 -0
  9. package/client/client/vcd.http.client.d.ts +32 -0
  10. package/client/client/vcd.transfer.client.d.ts +121 -0
  11. package/client/container-hooks/index.d.ts +58 -0
  12. package/client/index.d.ts +2 -0
  13. package/client/openapi.d.ts +76 -0
  14. package/client/query/filter.builder.d.ts +162 -0
  15. package/client/query/index.d.ts +2 -0
  16. package/client/query/query.builder.d.ts +30 -0
  17. package/common/container-hooks.d.ts +2 -2
  18. package/core/plugin.module.d.ts +10 -5
  19. package/esm2020/client/client/api.result.service.mjs +43 -0
  20. package/esm2020/client/client/constants.mjs +13 -0
  21. package/esm2020/client/client/index.mjs +8 -0
  22. package/esm2020/client/client/logging.interceptor.mjs +44 -0
  23. package/esm2020/client/client/request.headers.interceptor.mjs +91 -0
  24. package/esm2020/client/client/response.normalization.interceptor.mjs +59 -0
  25. package/esm2020/client/client/vcd.api.client.mjs +602 -0
  26. package/esm2020/client/client/vcd.http.client.mjs +52 -0
  27. package/esm2020/client/client/vcd.transfer.client.mjs +166 -0
  28. package/esm2020/client/container-hooks/index.mjs +57 -0
  29. package/esm2020/client/index.mjs +3 -0
  30. package/esm2020/client/openapi.mjs +16 -0
  31. package/esm2020/client/query/filter.builder.mjs +195 -0
  32. package/esm2020/client/query/index.mjs +3 -0
  33. package/esm2020/client/query/query.builder.mjs +79 -0
  34. package/esm2020/common/container-hooks.mjs +74 -0
  35. package/esm2020/common/index.mjs +2 -0
  36. package/esm2020/core/index.mjs +2 -0
  37. package/esm2020/core/plugin.module.mjs +18 -0
  38. package/esm2020/main.mjs +45 -0
  39. package/esm2020/public-api.mjs +8 -0
  40. package/esm2020/vcd-sdk.mjs +5 -0
  41. package/fesm2015/vcd-sdk.mjs +1513 -0
  42. package/fesm2015/vcd-sdk.mjs.map +1 -0
  43. package/fesm2020/vcd-sdk.mjs +1508 -0
  44. package/fesm2020/vcd-sdk.mjs.map +1 -0
  45. package/index.d.ts +5 -0
  46. package/main.d.ts +11 -5
  47. package/package.json +30 -39
  48. package/public-api.d.ts +1 -1
  49. package/LICENSE.txt +0 -12
  50. package/bundles/vcd-sdk.umd.js +0 -810
  51. package/bundles/vcd-sdk.umd.js.map +0 -1
  52. package/bundles/vcd-sdk.umd.min.js +0 -16
  53. package/bundles/vcd-sdk.umd.min.js.map +0 -1
  54. package/esm2015/common/container-hooks.js +0 -219
  55. package/esm2015/common/index.js +0 -6
  56. package/esm2015/core/index.js +0 -6
  57. package/esm2015/core/plugin.module.js +0 -53
  58. package/esm2015/i18n/index.js +0 -8
  59. package/esm2015/i18n/translate.pipe.js +0 -92
  60. package/esm2015/i18n/translate.service.js +0 -229
  61. package/esm2015/i18n/translation.loader.js +0 -63
  62. package/esm2015/main.js +0 -37
  63. package/esm2015/public-api.js +0 -12
  64. package/esm2015/vcd-sdk.js +0 -10
  65. package/esm5/common/container-hooks.js +0 -266
  66. package/esm5/common/index.js +0 -6
  67. package/esm5/core/index.js +0 -6
  68. package/esm5/core/plugin.module.js +0 -64
  69. package/esm5/i18n/index.js +0 -8
  70. package/esm5/i18n/translate.pipe.js +0 -108
  71. package/esm5/i18n/translate.service.js +0 -280
  72. package/esm5/i18n/translation.loader.js +0 -68
  73. package/esm5/main.js +0 -41
  74. package/esm5/public-api.js +0 -12
  75. package/esm5/vcd-sdk.js +0 -10
  76. package/fesm2015/vcd-sdk.js +0 -511
  77. package/fesm2015/vcd-sdk.js.map +0 -1
  78. package/fesm5/vcd-sdk.js +0 -620
  79. package/fesm5/vcd-sdk.js.map +0 -1
  80. package/i18n/index.d.ts +0 -3
  81. package/i18n/translate.pipe.d.ts +0 -12
  82. package/i18n/translate.service.d.ts +0 -21
  83. package/i18n/translation.loader.d.ts +0 -11
  84. package/schematics/collection.json +0 -10
  85. package/schematics/ng-add/index.d.ts +0 -3
  86. package/schematics/ng-add/index.js +0 -101
  87. package/schematics/ng-add/index.ts +0 -134
  88. package/schematics/ng-add/schema.d.ts +0 -8
  89. package/schematics/ng-add/schema.json +0 -19
  90. package/vcd-sdk.d.ts +0 -5
  91. package/vcd-sdk.metadata.json +0 -1
package/README.md CHANGED
@@ -1,119 +1,4 @@
1
- # vCD API Client #
2
- A collection of Typescript libraries for quickly and easily communication with a vCloud Director installation via its API.
1
+ # VMware Cloud Director Extensibility
2
+ Please file issues and pull requests against [Cloud Director Extension Standard Library](https://github.com/vmware/cloud-director-extension-standard-library).
3
3
 
4
- ## Overview ##
5
- The API client is currently made up of the following packages:
6
-
7
- ### @vcd/bindings ###
8
- A collection of Typescript objects that represent the vCD API's requests/responses.
9
-
10
- ### @vcd/sdk ###
11
- An Angular module that provides a REST API client with consistent handling of patterns and behaviors specific to the vCloud REST API. This module also contains various utilities and tools for things like query and filter management.
12
-
13
- ## Building ##
14
- ### Prerequisites ###
15
-
16
- Before the `api-client` packages can be built, the `java/api-schemas` projects must be built. Generation of the Java API bindings is a prerequisite to generating the Typescript bindings because it is these Java classes that drive the binding generation. From the `vcd-ext-sdk` project root directory:
17
-
18
- ```bash
19
- cd java
20
- mvn install
21
- ```
22
-
23
-
24
-
25
- Next navigate to the `api-client` folder and generate the bindings. **Note: these steps only need to be performed when the bindings change.**
26
-
27
- ```bash
28
- cd ../ui/api-client
29
- mvn generate-sources
30
- ```
31
-
32
- ### Install ###
33
-
34
- At this point, the Typescript source files will be generated in the bindings package, and the `api-client` project can be treated (more or less) like a traditional Node package. Executing the following 2 commands
35
-
36
- ```bash
37
- yarn
38
- yarn bootstrap
39
- ```
40
- will initialize the top level project, and then initialize and build `@vcd/bindings` and `@vcd/sdk`.
41
-
42
- ## Using the SDK ##
43
-
44
- Create a new Angular project. [Angular CLI](https://cli.angular.io/) provides a very simple mechanism to get up and running with a new Angular project. Once you have a project, the SDK and bindings can be added with a few simple steps:
45
-
46
- ### Using ng add @vcd/sdk ###
47
- 1. The same as the 1st **Regular Way** step
48
- 2. `ng add @vcd/sdk`
49
- 3. You will be prompted for the following:
50
- 3.1 Module name - VcdSdkModule by default
51
- 3.3 Path to the module where you want to import the package (Optional) - by default your it will be added to your root module, however you can specify a relative path to an specific module.
52
-
53
- ### Regular Way ###
54
-
55
- 1. Add `@vcd/bindings` and `@vcd/sdk` as project dependencies
56
- ```json
57
- // package.json
58
- {
59
-
60
- "dependencies": {
61
- ...,
62
- "@vcd/bindings": "<path to api-client/packages/bindings/dist>",
63
- "@vcd/sdk": "<path to api-client/packages/sdk/dist>",
64
- ...
65
- }
66
- }
67
- ```
68
- 2. Import `VcdSdkModule` into the app module and set `VcdApiClient` as a provider
69
- ```js
70
- @NgModule({
71
- declarations: [
72
- AppComponent
73
- ],
74
- imports: [
75
- BrowserModule,
76
- VcdSdkModule
77
- ],
78
- providers: [VcdApiClient],
79
- bootstrap: [AppComponent]
80
- })
81
-
82
- export class AppModule { }
83
-
84
- ```
85
- 3. Inject `VcdApiClient` into a component
86
- ```js
87
-
88
- constructor(private client: VcdApiClient) {}
89
-
90
- ```
91
- The SDK is now ready for use.
92
-
93
- ### Usage examples ###
94
- #### Authenticating ####
95
- If you don't have an existing session, you can create one:
96
- ```js
97
- ngOnInit(): void {
98
- this.client.login('username', 'org', 'pa$$w0rd').subscribe(() => {
99
- console.log(`logged into ${this.client.organization} as ${this.client.username}`);
100
- });
101
- ```
102
-
103
- If you already have an existing session (because you're acting as a UI extension and have access to the authentication token for example) you can simply set the authentication of the client instance to use the Bearer token:
104
- ```js
105
- ngOnInit(): void {
106
- this.client.setAuthentication(bearerToken).subscribe(() => {
107
- console.log(`logged into ${this.client.organization} as ${this.client.username}`);
108
- });
109
- ```
110
-
111
- #### Querying the API ####
112
- The query builder can be used to quickly create API calls that are compatible with the query service:
113
- ```js
114
- this.client.query(Query.Builder.ofType('virtualCenter'))).pipe(
115
-
116
- tap(queryResult => console.log(`Virtual centers: ${queryResult.total}`))
117
-
118
- ).subscribe();
119
- ```
4
+ Usage information and reference details can be found in [Cloud Director Extension Standard Library](https://github.com/vmware/cloud-director-extension-standard-library) documentation.
@@ -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
+ }