You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* const config = new TextDecoder('utf-8').decode(encodedConfig);
61
+
* };
62
+
* ```
63
+
*
64
+
* If instead you'd like to always ensure you fetch the latest parameter from the store regardless if already available in cache, use the `forceFetch` parameter.
65
+
*
66
+
* @example
67
+
* ```typescript
68
+
* import { AppConfigProvider } from '@aws-lambda-powertools/parameters/appconfig';
* const config = new TextDecoder('utf-8').decode(encodedConfig);
76
+
* };
77
+
* ```
78
+
*
79
+
* ### Transformations
80
+
*
81
+
* For configurations stored as freeform JSON, Freature Flag, you can use the transform argument for deserialization. This will return a JavaScript object instead of a string.
82
+
*
83
+
* @example
84
+
* ```typescript
85
+
* import { AppConfigProvider } from '@aws-lambda-powertools/parameters/appconfig';
* For configurations that are instead stored as base64-encoded binary data, you can use the transform argument set to `binary` for decoding. This will return a decoded string.
96
+
*
97
+
* @example
98
+
* ```typescript
99
+
* import { AppConfigProvider } from '@aws-lambda-powertools/parameters/appconfig';
* const config = new TextDecoder('utf-8').decode(encodedConfig);
127
+
* };
128
+
* ```
129
+
*
130
+
* This object accepts the same options as the [AWS SDK v3 for JavaScript AppConfigData client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-appconfigdata/interfaces/startconfigurationsessioncommandinput.html).
131
+
*
132
+
* ### Customize AWS SDK v3 for JavaScript client
133
+
*
134
+
* By default, the provider will create a new AppConfigData client using the default configuration.
135
+
*
136
+
* You can customize the client by passing a custom configuration object to the provider.
137
+
*
138
+
* @example
139
+
* ```typescript
140
+
* import { AppConfigProvider } from '@aws-lambda-powertools/parameters/appconfig';
141
+
*
142
+
* const configProvider = new AppConfigProvider({
143
+
* clientConfig: { region: 'eu-west-1' },
144
+
* });
145
+
* ```
146
+
*
147
+
* This object accepts the same options as the [AWS SDK v3 for JavaScript AppConfig Data client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-appconfigdata/interfaces/appconfigdataclientconfig.html).
148
+
*
149
+
* Otherwise, if you want to use a custom client altogether, you can pass it to the provider.
150
+
*
151
+
* @example
152
+
* ```typescript
153
+
* import { AppConfigProvider } from '@aws-lambda-powertools/parameters/appconfig';
154
+
* import { AppConfigDataClient } from '@aws-sdk/client-appconfigdata';
155
+
*
156
+
* const client = new AppConfigDataClient({ region: 'eu-west-1' });
157
+
* const configProvider = new AppConfigProvider({
158
+
* awsSdkV3Client: client,
159
+
* });
160
+
* ```
161
+
*
162
+
* This object must be an instance of the [AWS SDK v3 for JavaScript AppConfig Data client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-appconfigdata/classes/appconfigdataclient.html).
163
+
*
164
+
* For more usage examples, see [our documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/utilities/parameters/).
165
+
*
166
+
* @param {string} name - The name of the configuration profile or its ID
167
+
* @param {GetAppConfigCombinedInterface} options - Options to configure the provider
* @param {string} name - The configuration profile ID or the configuration profile name.
8
-
* @param {GetAppConfigCombinedInterface} options - Options for the AppConfigProvider and the get method.
9
-
* @returns {Promise<undefined | string | Uint8Array | Record<string, unknown>>} A promise that resolves to the AppConfig data or undefined if not found.
19
+
* ## Basic usage
20
+
*
21
+
* @example
22
+
* ```typescript
23
+
* import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
* const config = new TextDecoder('utf-8').decode(encodedConfig);
47
+
* };
48
+
* ```
49
+
*
50
+
* If instead you'd like to always ensure you fetch the latest parameter from the store regardless if already available in cache, use the `forceFetch` parameter.
51
+
*
52
+
* @example
53
+
* ```typescript
54
+
* import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
* const config = new TextDecoder('utf-8').decode(encodedConfig);
60
+
* };
61
+
* ```
62
+
*
63
+
* ### Transformations
64
+
*
65
+
* For configurations stored as freeform JSON, Freature Flag, you can use the transform argument for deserialization. This will return a JavaScript object instead of a string.
66
+
*
67
+
* @example
68
+
* ```typescript
69
+
* import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
* For configurations that are instead stored as base64-encoded binary data, you can use the transform argument set to `binary` for decoding. This will return a decoded string.
78
+
*
79
+
* @example
80
+
* ```typescript
81
+
* import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';
* const config = new TextDecoder('utf-8').decode(encodedConfig);
105
+
* };
106
+
* ```
107
+
*
108
+
* This object accepts the same options as the [AWS SDK v3 for JavaScript AppConfigData client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-appconfigdata/interfaces/startconfigurationsessioncommandinput.html).
109
+
*
110
+
* ### Built-in provider class
111
+
*
112
+
* For greater flexibility such as configuring the underlying SDK client used by built-in providers, you can use the {@link AppConfigProvider} class.
113
+
*
114
+
* For more usage examples, see [our documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/utilities/parameters/).
115
+
*
116
+
* @param {string} name - The name of the configuration profile or its ID
117
+
* @param {GetAppConfigCombinedInterface} options - Options to configure the provider
0 commit comments