putConformancePack method
Creates or updates a conformance pack. A conformance pack is a collection of AWS Config rules that can be easily deployed in an account and a region and across AWS Organization.
This API creates a service linked role
AWSServiceRoleForConfigConforms
in your account. The service
linked role is created only when the role does not exist in your account.
May throw InsufficientPermissionsException. May throw ConformancePackTemplateValidationException. May throw ResourceInUseException. May throw InvalidParameterValueException. May throw MaxNumberOfConformancePacksExceededException.
Parameter conformancePackName
:
Name of the conformance pack you want to create.
Parameter conformancePackInputParameters
:
A list of ConformancePackInputParameter
objects.
Parameter deliveryS3Bucket
:
AWS Config stores intermediate files while processing conformance pack
template.
Parameter deliveryS3KeyPrefix
:
The prefix for the Amazon S3 bucket.
Parameter templateBody
:
A string containing full conformance pack template body. Structure
containing the template body with a minimum length of 1 byte and a maximum
length of 51,200 bytes.
Parameter templateS3Uri
:
Location of file containing the template body
(s3://bucketname/prefix
). The uri must point to the
conformance pack template (max size: 300 KB) that is located in an Amazon
S3 bucket in the same region as the conformance pack.
Implementation
Future<PutConformancePackResponse> putConformancePack({
required String conformancePackName,
List<ConformancePackInputParameter>? conformancePackInputParameters,
String? deliveryS3Bucket,
String? deliveryS3KeyPrefix,
String? templateBody,
String? templateS3Uri,
}) async {
ArgumentError.checkNotNull(conformancePackName, 'conformancePackName');
_s.validateStringLength(
'conformancePackName',
conformancePackName,
1,
256,
isRequired: true,
);
_s.validateStringLength(
'deliveryS3Bucket',
deliveryS3Bucket,
0,
63,
);
_s.validateStringLength(
'deliveryS3KeyPrefix',
deliveryS3KeyPrefix,
0,
1024,
);
_s.validateStringLength(
'templateBody',
templateBody,
1,
51200,
);
_s.validateStringLength(
'templateS3Uri',
templateS3Uri,
1,
1024,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'StarlingDoveService.PutConformancePack'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ConformancePackName': conformancePackName,
if (conformancePackInputParameters != null)
'ConformancePackInputParameters': conformancePackInputParameters,
if (deliveryS3Bucket != null) 'DeliveryS3Bucket': deliveryS3Bucket,
if (deliveryS3KeyPrefix != null)
'DeliveryS3KeyPrefix': deliveryS3KeyPrefix,
if (templateBody != null) 'TemplateBody': templateBody,
if (templateS3Uri != null) 'TemplateS3Uri': templateS3Uri,
},
);
return PutConformancePackResponse.fromJson(jsonResponse.body);
}