|
| 1 | +// Copyright The Perses Authors |
| 2 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | +// you may not use this file except in compliance with the License. |
| 4 | +// You may obtain a copy of the License at |
| 5 | +// |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +// |
| 8 | +// Unless required by applicable law or agreed to in writing, software |
| 9 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +// See the License for the specific language governing permissions and |
| 12 | +// limitations under the License. |
| 13 | + |
| 14 | +export interface HTTPProxy { |
| 15 | + kind: 'HTTPProxy'; |
| 16 | + spec: HTTPProxySpec; |
| 17 | +} |
| 18 | +export interface HTTPProxySpec { |
| 19 | + // url is the url of the datasource. It is not the url of the proxy. |
| 20 | + // The Perses server is the proxy, so it needs to know where to redirect the request. |
| 21 | + url: string; |
| 22 | + // allowedEndpoints is a list of tuples of http methods and http endpoints that will be accessible. |
| 23 | + // Leave it empty if you don't want to restrict the access to the datasource. |
| 24 | + allowedEndpoints?: HTTPAllowedEndpoint[]; |
| 25 | + // headers can be used to provide additional headers that need to be forwarded when requesting the datasource |
| 26 | + headers?: RequestHeaders; |
| 27 | + // secret is the name of the secret that should be used for the proxy or discovery configuration |
| 28 | + // It will contain any sensitive information such as password, token, certificate. |
| 29 | + secret?: string; |
| 30 | +} |
| 31 | + |
| 32 | +export interface HTTPAllowedEndpoint { |
| 33 | + endpointPattern: string; |
| 34 | + method: string; |
| 35 | +} |
| 36 | + |
| 37 | +export type RequestHeaders = Record<string, string>; |
| 38 | + |
| 39 | +export interface HTTPDatasourceSpec { |
| 40 | + directUrl?: string; |
| 41 | + proxy?: HTTPProxy; |
| 42 | +} |
0 commit comments