putParameter method
Add a parameter to the system.
May throw InternalServerError. May throw InvalidKeyId. May throw ParameterLimitExceeded. May throw TooManyUpdates. May throw ParameterAlreadyExists. May throw HierarchyLevelLimitExceededException. May throw HierarchyTypeMismatchException. May throw InvalidAllowedPatternException. May throw ParameterMaxVersionLimitExceeded. May throw ParameterPatternMismatchException. May throw UnsupportedParameterType. May throw PoliciesLimitExceededException. May throw InvalidPolicyTypeException. May throw InvalidPolicyAttributeException. May throw IncompatiblePolicyException.
Parameter name
:
The fully qualified name of the parameter that you want to add to the
system. The fully qualified name includes the complete hierarchy of the
parameter path and name. For parameters in a hierarchy, you must include a
leading forward slash character (/) when you create or reference a
parameter. For example: /Dev/DBServer/MySQL/db-string13
Naming Constraints:
- Parameter names are case sensitive.
- A parameter name must be unique within an AWS Region
- A parameter name can't be prefixed with "aws" or "ssm" (case-insensitive).
-
Parameter names can include only the following symbols and letters:
a-zA-Z0-9_.-/
- A parameter name can't include spaces.
- Parameter hierarchies are limited to a maximum depth of fifteen levels.
Implementation
Future<PutParameterResult> putParameter({
required String name,
required String value,
String? allowedPattern,
String? dataType,
String? description,
String? keyId,
bool? overwrite,
String? policies,
List<Tag>? tags,
ParameterTier? tier,
ParameterType? type,
}) async {
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
2048,
isRequired: true,
);
ArgumentError.checkNotNull(value, 'value');
_s.validateStringLength(
'allowedPattern',
allowedPattern,
0,
1024,
);
_s.validateStringLength(
'dataType',
dataType,
0,
128,
);
_s.validateStringLength(
'description',
description,
0,
1024,
);
_s.validateStringLength(
'keyId',
keyId,
1,
256,
);
_s.validateStringLength(
'policies',
policies,
1,
4096,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonSSM.PutParameter'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
'Value': value,
if (allowedPattern != null) 'AllowedPattern': allowedPattern,
if (dataType != null) 'DataType': dataType,
if (description != null) 'Description': description,
if (keyId != null) 'KeyId': keyId,
if (overwrite != null) 'Overwrite': overwrite,
if (policies != null) 'Policies': policies,
if (tags != null) 'Tags': tags,
if (tier != null) 'Tier': tier.toValue(),
if (type != null) 'Type': type.toValue(),
},
);
return PutParameterResult.fromJson(jsonResponse.body);
}