@@ -125,6 +125,63 @@ def __init__(
125
125
config = config ,
126
126
)
127
127
128
+ def get_multiple ( # type: ignore[override]
129
+ self ,
130
+ path : str ,
131
+ max_age : Optional [int ] = None ,
132
+ transform : TransformOptions = None ,
133
+ raise_on_transform_error : bool = False ,
134
+ decrypt : Optional [bool ] = None ,
135
+ force_fetch : bool = False ,
136
+ recursive : bool = False ,
137
+ ** sdk_options ,
138
+ ) -> Union [Dict [str , str ], Dict [str , dict ], Dict [str , bytes ]]:
139
+ """
140
+ Retrieve multiple parameters based on a path prefix
141
+
142
+ Parameters
143
+ ----------
144
+ path: str
145
+ Parameter path used to retrieve multiple parameters
146
+ max_age: int, optional
147
+ Maximum age of the cached value
148
+ transform: str, optional
149
+ Optional transformation of the parameter value. Supported values
150
+ are "json" for JSON strings, "binary" for base 64 encoded
151
+ values or "auto" which looks at the attribute key to determine the type.
152
+ raise_on_transform_error: bool, optional
153
+ Raises an exception if any transform fails, otherwise this will
154
+ return a None value for each transform that failed
155
+ force_fetch: bool, optional
156
+ Force update even before a cached item has expired, defaults to False
157
+ recursive: bool, optional
158
+ If this should retrieve the parameter values recursively or not
159
+ sdk_options: dict, optional
160
+ Arguments that will be passed directly to the underlying API call
161
+
162
+ Raises
163
+ ------
164
+ GetParameterError
165
+ When the parameter provider fails to retrieve parameter values for
166
+ a given path.
167
+ TransformParameterError
168
+ When the parameter provider fails to transform a parameter value.
169
+ """
170
+
171
+ # If max_age is not set, resolve it from the environment variable, defaulting to DEFAULT_MAX_AGE_SECS
172
+ max_age = resolve_max_age (env = os .getenv (constants .PARAMETERS_MAX_AGE_ENV , DEFAULT_MAX_AGE_SECS ), choice = max_age )
173
+
174
+ # If decrypt is not set, resolve it from the environment variable, defaulting to False
175
+ decrypt = resolve_truthy_env_var_choice (
176
+ env = os .getenv (constants .PARAMETERS_SSM_DECRYPT_ENV , "false" ),
177
+ choice = decrypt ,
178
+ )
179
+
180
+ sdk_options ["decrypt" ] = decrypt
181
+ sdk_options ["recursive" ] = recursive
182
+
183
+ return super ().get_multiple (path , max_age , transform , force_fetch , raise_on_transform_error , ** sdk_options )
184
+
128
185
# We break Liskov substitution principle due to differences in signatures of this method and superclass get method
129
186
# We ignore mypy error, as changes to the signature here or in a superclass is a breaking change to users
130
187
def get ( # type: ignore[override]
@@ -341,12 +398,6 @@ def _get_multiple(
341
398
Dictionary of options that will be passed to the Parameter Store get_parameters_by_path API call
342
399
"""
343
400
344
- # If decrypt is not set, resolve it from the environment variable, defaulting to False
345
- decrypt = resolve_truthy_env_var_choice (
346
- env = os .getenv (constants .PARAMETERS_SSM_DECRYPT_ENV , "false" ),
347
- choice = decrypt ,
348
- )
349
-
350
401
# Explicit arguments will take precedence over keyword arguments
351
402
sdk_options ["Path" ] = path
352
403
sdk_options ["WithDecryption" ] = decrypt
@@ -788,14 +839,12 @@ def get_parameter(
788
839
choice = decrypt ,
789
840
)
790
841
791
- # Add to `decrypt` sdk_options to we can have an explicit option for this
792
- sdk_options ["decrypt" ] = decrypt
793
-
794
842
return DEFAULT_PROVIDERS ["ssm" ].get (
795
- name ,
843
+ name = name ,
796
844
max_age = max_age ,
797
845
transform = transform ,
798
846
force_fetch = force_fetch ,
847
+ decrypt = decrypt ,
799
848
** sdk_options ,
800
849
)
801
850
@@ -928,15 +977,14 @@ def get_parameters(
928
977
choice = decrypt ,
929
978
)
930
979
931
- sdk_options ["recursive" ] = recursive
932
- sdk_options ["decrypt" ] = decrypt
933
-
934
980
return DEFAULT_PROVIDERS ["ssm" ].get_multiple (
935
- path ,
981
+ path = path ,
936
982
max_age = max_age ,
937
983
transform = transform ,
938
984
raise_on_transform_error = raise_on_transform_error ,
939
985
force_fetch = force_fetch ,
986
+ recursive = recursive ,
987
+ decrypt = decrypt ,
940
988
** sdk_options ,
941
989
)
942
990
0 commit comments