getParametersByPath method

Future<GetParametersByPathResult> getParametersByPath({
  1. required String path,
  2. int? maxResults,
  3. String? nextToken,
  4. List<ParameterStringFilter>? parameterFilters,
  5. bool? recursive,
  6. bool? withDecryption,
})

Retrieve information about one or more parameters under a specified level in a hierarchy.

Request results are returned on a best-effort basis. If you specify MaxResults in the request, the response includes information up to the limit specified. The number of items returned, however, can be between zero and the value of MaxResults. If the service reaches an internal limit while processing the results, it stops the operation and returns the matching values up to that point and a NextToken. You can specify the NextToken in a subsequent call to get the next set of results.

Parameter names can't contain spaces. The service removes any spaces specified for the beginning or end of a parameter name. If the specified name for a parameter contains spaces between characters, the request fails with a ValidationException error.

May throw InternalServerError. May throw InvalidFilterKey. May throw InvalidFilterOption. May throw InvalidFilterValue. May throw InvalidKeyId. May throw InvalidNextToken.

Parameter path : The hierarchy for the parameter. Hierarchies start with a forward slash (/). The hierarchy is the parameter name except the last part of the parameter. For the API call to succeed, the last part of the parameter name can't be in the path. A parameter name hierarchy can have a maximum of 15 levels. Here is an example of a hierarchy: /Finance/Prod/IAD/WinServ2016/license33

Parameter maxResults : The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

Parameter nextToken : A token to start the list. Use this token to get the next set of results.

Parameter parameterFilters : Filters to limit the request results.

The following Key values aren't supported for GetParametersByPath: tag, DataType, Name, Path, and Tier.

Parameter recursive : Retrieve all parameters within a hierarchy.

Parameter withDecryption : Retrieve all parameters in a hierarchy with their value decrypted.

Implementation

Future<GetParametersByPathResult> getParametersByPath({
  required String path,
  int? maxResults,
  String? nextToken,
  List<ParameterStringFilter>? parameterFilters,
  bool? recursive,
  bool? withDecryption,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    10,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.GetParametersByPath'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Path': path,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (parameterFilters != null) 'ParameterFilters': parameterFilters,
      if (recursive != null) 'Recursive': recursive,
      if (withDecryption != null) 'WithDecryption': withDecryption,
    },
  );

  return GetParametersByPathResult.fromJson(jsonResponse.body);
}