Skip to content

Commit

Permalink
feat(parameters): SSMProvider support (#1187)
Browse files Browse the repository at this point in the history
* feat: added SSMProvider.get

* added sdk as devDependency

* build: updated dependencies

* feat: base get

* feat: added decrypt option to get param

* feat: implemented getParameter function

* feat: SSMProvider.getMultiple

* feat: getParameters fn

* chore: merge conflicts

* refactor: moved SSM specific logic from BaseProvider to SSMProvider

* wip: other ssmprovider features

* wip: other ssmprovider features

* wip: other ssmprovider features

* feat: completed SSMProvider implementation

* refactor: folder structure

* refactor: aliases

* refactor: changed variable names in splitBatchAndDecryptParameters

* refactor: readability & naming

* refactor: updated constructor type + interface intersections

* chore: types
  • Loading branch information
dreamorosi committed Jan 5, 2023
1 parent 32bd7e8 commit 2e4bb76
Show file tree
Hide file tree
Showing 14 changed files with 4,177 additions and 797 deletions.
2,974 changes: 2,192 additions & 782 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/parameters/package.json
Expand Up @@ -55,6 +55,7 @@
],
"devDependencies": {
"@aws-sdk/client-secrets-manager": "^3.238.0",
"@aws-sdk/client-ssm": "^3.244.0",
"aws-sdk-client-mock": "^2.0.1",
"aws-sdk-client-mock-jest": "^2.0.1"
}
Expand Down
28 changes: 14 additions & 14 deletions packages/parameters/src/BaseProvider.ts
Expand Up @@ -98,6 +98,20 @@ abstract class BaseProvider implements BaseProviderInterface {
return values;
}

/**
* Check whether a key has expired in the cache or not
*
* It returns true if the key is expired or not present in the cache.
*
* @param {string} key - Stringified representation of the key to retrieve
*/
public hasKeyExpiredInCache(key: string): boolean {
const value = this.store.get(key);
if (value) return value.isExpired();

return true;
}

/**
* Retrieve parameter value from the underlying parameter store
*
Expand All @@ -114,20 +128,6 @@ abstract class BaseProvider implements BaseProviderInterface {
*/
protected abstract _getMultiple(path: string, options?: unknown): Promise<Record<string, string | undefined>>;

/**
* Check whether a key has expired in the cache or not
*
* It returns true if the key is expired or not present in the cache.
*
* @param {string} key - Stringified representation of the key to retrieve
*/
private hasKeyExpiredInCache(key: string): boolean {
const value = this.store.get(key);
if (value) return value.isExpired();

return true;
}

}

const transformValue = (value: string | Uint8Array | undefined, transform: TransformOptions, throwOnTransformError: boolean, key: string): string | Record<string, unknown> | undefined => {
Expand Down

0 comments on commit 2e4bb76

Please sign in to comment.