Skip to content

Commit 4899aed

Browse files
authored
add fetchSecretById and refreshTokenBySecretId (#72)
Add fetchSecretById and refreshTokenBySecretId for `PlatformApiLogicClient` Add Faceless Rest Client
1 parent 0e3a550 commit 4899aed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+7154
-3623
lines changed

.env.example

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
ELASTICIO_OBJECT_STORAGE_TOKEN=feyJhbGciasfdJ0uhN__D0asdasdq283d283d
2-
ELASTICIO_OBJECT_STORAGE_URI=http://localhost:3002
1+
ELASTICIO_OBJECT_STORAGE_TOKEN=feyJhbGciasfdJ0uhN__D0asdasdq283d283d
2+
ELASTICIO_OBJECT_STORAGE_URI=http://localhost:3002
3+
ELASTICIO_API_USERNAME=[email protected]
4+
ELASTICIO_API_KEY=3333-4444-2222-3333-2222222
5+
ELASTICIO_API_URI=https://api.elastic.io
6+
ELASTICIO_WORKSPACE_ID=2323232fdfdfd232323
7+
SECRET_ID=sdsdsd2323232df

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@ typings/
106106
!.eslintrc.js
107107
*.d.ts
108108

109-
/dist/package.json
109+
/dist

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.1.0 (September 9, 2022)
2+
* Added method `fetchSecretById` for `PlatformApiLogicClient`
3+
* Added method `refreshTokenBySecretId` for `PlatformApiLogicClient`
4+
* Added User-Agent headers to `PlatformApiRestClient`
5+
* Added new REST client `FacelessRestClient`
6+
17
## 3.0.2 (August 26, 2022)
28
* Updated @elasticio/maester-client to v4.0.3
39

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
- [ApiKeyRestClient](#ApiKeyRestClient)
1111
- [CookieRestClient](#CookieRestClient)
1212
- [OAuth2AuthorizationCodeRestClient](#OAuth2AuthorizationCodeRestClient)
13-
- [Platform API Clients](#PlatformAPI-Clients)
13+
- [FacelessRestClient](#FacelessRestClient)
14+
- [Platform API Clients](#Platform-API-Clients)
1415
- [PlatformApiRestClient](#PlatformApiRestClient)
1516
- [PlatformApiLogicClient](#PlatformApiLogicClient)
1617
- [JSON Schema Converter](#JSON-Schema-Converter)
@@ -125,6 +126,19 @@ const Client = new OAuth2AuthorizationCodeRestClient(emitter, cfg);
125126
```
126127
This class can handle, refresh and emit oauth2 EIO configuration.
127128

129+
### FacelessRestClient
130+
[FacelessRestClient](https://github.com/elasticio/component-commons-library/blob/master/src/authentication/FacelessRestClient.ts)
131+
Makes requests to resource with oauth2 access token auth using ElasticIO [Faceless Service](https://docs.elastic.io/guides/secrets.html).
132+
133+
#### constructor(emitter, cfg, userAgent, msgId)
134+
135+
- cfg - should contain `secretId` parameter or `oauth` object with oauth2 config and tokens.
136+
- userAgent - optional parameter, used for `User-Agent` header when client retrieve secret from platform
137+
- msgId - optional parameter, used for `x-request-id` header when client retrieve secret from platform
138+
```
139+
const Client = new FacelessRestClient(emitter, cfg, userAgent, msgId);
140+
```
141+
128142
### NtlmRestClient
129143
[NtlmRestClient](https://github.com/elasticio/component-commons-library/blob/master/src/authentication/NtlmRestClient.ts)
130144
class extends [NoAuthRestClient](#NoAuthRestClient) class.
@@ -173,6 +187,8 @@ const Client = new PlatformApiLogicClient(emitter, cfg);
173187
- fetchAllFlowsForWorkspace(options) - Fetch all flows for a given workspace
174188
- fetchAllCredentialsForWorkspace(options) - Fetch all credentials for a given workspace
175189
- fetchAllSecretsForWorkspace - Fetch all secrets for a given workspace
190+
- fetchSecretById - Fetch secret by id for a given workspace
191+
- refreshTokenBySecretId - Refresh token by secret id for a given workspace
176192
- fetchComponentsAccessibleFromContract(options) - Fetch All Components Accessible From a Given Workspace
177193
- splitParallelization(maxParallelization, splitFactor) - Helping method to calculate right number of parallel calls
178194
- fetchFlowList(options) - Fetches a list of flows

dist/spec-integration/attachmentProcessor.spec.js

-78
This file was deleted.

dist/spec-integration/common.js

-23
This file was deleted.

dist/spec/attachment/AttachmentProcessor.spec.js

-66
This file was deleted.

dist/spec/authentication/ApiKeyRestClient.spec.js

-77
This file was deleted.

0 commit comments

Comments
 (0)