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.

For higher-volume workloads, you can enable higher throughput. This increases the maximum number of supported transactions per second for your account and Region. Increased throughput supports applications and workloads that need concurrent access to multiple parameters. If you experience ThrottlingException: Rate exceeded errors, enable higher throughput. For more information, see Changing Parameter Store throughput.

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);
}