getParameter method

Future<GetParameterResult> getParameter({
  1. required String name,
  2. bool? withDecryption,
})

Get information about a single parameter by specifying the parameter name.

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 InvalidKeyId. May throw ParameterNotFound. May throw ParameterVersionNotFound.

Parameter name : The name or Amazon Resource Name (ARN) of the parameter that you want to query. For parameters shared with you from another account, you must use the full ARN.

To query by parameter label, use "Name": "name:label". To query by parameter version, use "Name": "name:version".

For more information about shared parameters, see Working with shared parameters in the Amazon Web Services Systems Manager User Guide.

Parameter withDecryption : Return decrypted values for secure string parameters. This flag is ignored for String and StringList parameter types.

Implementation

Future<GetParameterResult> getParameter({
  required String name,
  bool? withDecryption,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.GetParameter'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      if (withDecryption != null) 'WithDecryption': withDecryption,
    },
  );

  return GetParameterResult.fromJson(jsonResponse.body);
}