UNPKG

9.75 kBTypeScriptView Raw
1import { CachingOptions, IsolationStrategy } from '../cache';
2import { ProxyConfiguration } from '../connectivity-service-types';
3import { ResilienceOptions } from '../resilience-options';
4/**
5 * A resolved destination containing information needed to execute requests, such as the system URL.
6 *
7 * You can create a destination as a local object when supplying all necessary information, or it could be retrieved from the destination service on SAP Business Technology Platform (via [[DestinationNameAndJwt]]).
8 * When creating a local object representing a destination, you need to supply at least the [[url]] and, if required by the target system, valid credentials with [[username]] and [[password]].
9 */
10export interface Destination {
11 /**
12 * Name of the destination retrieved from SAP Business Technology Platform.
13 */
14 name?: string | null;
15 /**
16 * Base URL for calls to this destination.
17 * The URL has to define the protocol, like `http://` or `https://`, and a host.
18 * The path for requests against this destination will be appended to the path defined in the URL as a new path segment.
19 */
20 url: string;
21 /**
22 * Type of authentication to use.
23 *
24 * Defaults to `NoAuthentication`, unless [[username]] and [[password]] are provided, in which case the default is `BasicAuthentication`.
25 */
26 authentication?: AuthenticationType;
27 /**
28 * Proxy type to specify whether the target resides on-premise (not used).
29 */
30 proxyType?: DestinationProxyType;
31 /**
32 * @deprecated Since v1.0.1.
33 * Origin of the destination in a multi-tenant setup on SAP Business Technology Platform (either from provider or subscriber account), optional.
34 */
35 origin?: DestinationOrigin;
36 /**
37 * Client to target in an SAP system, will be added as HTTP header `sap-client` if set.
38 */
39 sapClient?: string | undefined | null;
40 /**
41 * Username to use for basic authentication, optional if other means of authentication shall be used.
42 */
43 username?: string | null;
44 /**
45 * Password to use for basic authentication, optional if other means of authentication shall be used.
46 */
47 password?: string | null;
48 /**
49 * Authentication tokens returned from destination service on SAP Business Technology Platform.
50 */
51 authTokens?: DestinationAuthToken[] | null;
52 /**
53 * Flag indicating whether all certificates should be accepted when communicating with the destination. Should not be "true" in production.
54 */
55 isTrustingAllCertificates?: boolean;
56 /**
57 * ProxyConfiguration for on-premise connectivity and http(s) web proxies. Is present if proxyType of the destination equals "OnPremise" or environment variables [http_proxy] or [https_proxy] are set See [[ProxyConfiguration]].
58 */
59 proxyConfiguration?: ProxyConfiguration;
60 /**
61 * Client Id used to retrieve access token for "OAuth2ClientCredentials", "OAuth2UserTokenExchange" and "OAuth2JWTBearer" authentication.
62 */
63 clientId?: string;
64 /**
65 * Client Secret used to retrieve access token for "OAuth2ClientCredentials", "OAuth2UserTokenExchange" and "OAuth2JWTBearer" authentication.
66 */
67 clientSecret?: string;
68 /**
69 * URL to retrieve access token for "OAuth2ClientCredentials", "OAuth2UserTokenExchange" and "OAuth2JWTBearer" authentication.
70 */
71 tokenServiceUrl?: string;
72 /**
73 * User for basic authentication to OAuth server (if required).
74 */
75 tokenServiceUser?: string;
76 /**
77 * Password for tokenServiceUser (if required).
78 */
79 tokenServicePassword?: string;
80 /**
81 * The type of the destination, defaults to 'HTTP'. The SAP Cloud SDK only understands destinations of type 'HTTP'.
82 */
83 type?: 'HTTP' | 'LDAP' | 'MAIL' | 'RFC';
84 /**
85 * Further properties of the destination as defined in destination service on SAP Business Technology Platform, possibly empty.
86 */
87 originalProperties?: {
88 [key: string]: any;
89 };
90 /**
91 * Flag indicating whether the destination is for test purpose. Should be "undefined" or "false" for non-mocked destinations.
92 */
93 isTestDestination?: boolean;
94 /**
95 * Location ID of the Cloud Connector to be used for connection to an On-Premise system. Optional. Corresponds to property "CloudConnectorLocationId" in the additional properties of a destination.
96 */
97 cloudConnectorLocationId?: string;
98 /**
99 * Array of certificates used for authentication type ClientCertificateAuthentication.
100 */
101 certificates?: DestinationCertificate[];
102 /**
103 * Name of the key store/certificate to be used for ClientCertificateAuthentication.
104 */
105 keyStoreName?: string;
106 /**
107 * Password of the key store/certificate to be used for ClientCertificateAuthentication.
108 */
109 keyStorePassword?: string;
110 /**
111 * System user to be used for OAuth2SAMLBearerAssertion authentication type.
112 */
113 systemUser?: string;
114 /**
115 * Additional headers to be used for calls against the destination, originally defined by `URL.headers.<header-name>`.
116 * The keys of this object denote the names of the headers and the values their values.
117 */
118 headers?: Record<string, any>;
119 /**
120 * Additional query parameters to be used for calls against the destination, originally defined by `URL.queries.<query-parameter-name>`.
121 * The keys of this object denote the names of the query parameters and the values their values.
122 */
123 queryParameters?: Record<string, any>;
124 /**
125 * If set to true the auth token provided to the request execution is forwarded to the destination target.
126 */
127 forwardAuthToken?: boolean;
128}
129/**
130 * Represents authentication token returned from destination service.
131 */
132export interface DestinationAuthToken {
133 type: string;
134 value: string;
135 expiresIn: string;
136 error: string | null;
137 http_header: {
138 key: string;
139 value: string;
140 };
141}
142export declare type DestinationProxyType = 'OnPremise' | 'Internet' | 'PrivateLink' | null;
143/**
144 * Represents a certificate attached to a destination.
145 */
146export interface DestinationCertificate {
147 /**
148 * Name of the certificate file.
149 */
150 name: string;
151 /**
152 * Content of the certificate as base64 encoded binary.
153 */
154 content: string;
155 /**
156 * Type of the certificate.
157 */
158 type: string;
159}
160/**
161 * @deprecated Since v1.0.1.
162 *
163 * Represents the origin of a destination in a multi-tenant setup on SAP Business Technology Platform.
164 *
165 * In a multi-tenant application on SAP Business Technology Platform, destinations can be defined both on provider account level ("PaaS tenant") as well as on the level of each subscriber account ("SaaS tenant").
166 */
167export declare enum DestinationOrigin {
168 Subscriber = "subscriber",
169 Provider = "provider"
170}
171/**
172 * Declaration of a destination to be retrieved from an environment variable or from the destination service on SAP Business Technology Platform.
173 *
174 * Use an object of this interface to specify which destination shall be used when executing a request.
175 * The destination will be retrieved via its [[DestinationNameAndJwt.destinationName]] according to the following algorithm:
176 * 1. If a destination of this [[DestinationNameAndJwt.destinationName]] is defined in the environment variable `destinations` (if available), it will be converted into a [[Destination]] and used for the request.
177 * 2. Otherwise, the destination service on SAP Business Technology Platform is queried for a destination with the given [[DestinationNameAndJwt.destinationName]], using the access token provided as value of property [[jwt]].
178 */
179export interface DestinationNameAndJwt {
180 /**
181 * Name of the destination to retrieve, mandatory.
182 */
183 destinationName: string;
184 /**
185 * An access token for the XSUAA service on SAP Business Technology Platform, provided as a JSON Web Token, only mandatory when destination shall be retrieved from destination service on SAP Business Technology Platform.
186 */
187 jwt?: string;
188}
189/**
190 * @deprecated Since version 1.16.0. Use [[CachingOptions]] instead.
191 */
192export interface DestinationCachingOptions {
193 /**
194 * A boolean value that indicates whether to read destinations from cache.
195 */
196 useCache?: boolean;
197 /**
198 * The isolation strategy used for caching destinations. For the available options, see [[IsolationStrategy]].
199 * By default, IsolationStrategy.Tenant is set.
200 */
201 isolationStrategy?: IsolationStrategy;
202}
203/**
204 * Options to use while fetching destinations. Encompasses both [[DestinationCachingOptions]] and [[ResilienceOptions]] interfaces.
205 */
206export declare type DestinationRetrievalOptions = (DestinationCachingOptions | CachingOptions) & ResilienceOptions;
207export declare function isDestinationNameAndJwt(destination: any): destination is DestinationNameAndJwt;
208export declare function isDestination(destination: any): destination is Destination;
209export declare type AuthenticationType = 'PrincipalPropagation' | 'NoAuthentication' | 'BasicAuthentication' | 'OAuth2SAMLBearerAssertion' | 'OAuth2ClientCredentials' | 'OAuth2UserTokenExchange' | 'ClientCertificateAuthentication' | 'OAuth2JWTBearer' | 'OAuth2Password';
210/**
211 * The destinations endpoint distinguished between destinations maintained on service level (instance) and account level (subaccount).
212 * This enum is used as a switch in the [[fetchInstanceDestinations]], [[fetchSubaccountDestinations]] and [[destinationServiceCache]]
213 */
214export declare enum DestinationType {
215 Instance = "instance",
216 Subaccount = "subaccount"
217}
218//# sourceMappingURL=destination-service-types.d.ts.map
\No newline at end of file