putConformancePack method
Creates or updates a conformance pack. A conformance pack is a collection of Config rules that can be easily deployed in an account and a region and across an organization. For information on how many conformance packs you can have per account, see Service Limits in the Config Developer Guide.
This API uses the AWSServiceRoleForConfigConforms
service-linked role in your account to create conformance pack resources.
This service-linked role includes the permissions to create Config rules
and remediation configurations, even if your account IAM policies
explicitly deny these actions.
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.
PutConformancePack is an idempotent API. Subsequent requests
won't create a duplicate resource if one was already created. If a
following request has different tags values, Config will
ignore these differences and treat it as an idempotent request of the
previous. In this case, tags will not be updated, even if
they are different.
Use TagResource and UntagResource to update tags after creation.
May throw ConformancePackTemplateValidationException.
May throw InsufficientPermissionsException.
May throw InvalidParameterValueException.
May throw MaxNumberOfConformancePacksExceededException.
May throw ResourceInUseException.
Parameter conformancePackName :
The unique name of the conformance pack you want to deploy.
Parameter conformancePackInputParameters :
A list of ConformancePackInputParameter objects.
Parameter deliveryS3Bucket :
The name of the Amazon S3 bucket where Config stores conformance pack
templates.
Parameter deliveryS3KeyPrefix :
The prefix for the Amazon S3 bucket.
Parameter tags :
The tags for the conformance pack. Each tag consists of a key and an
optional value, both of which you define.
Parameter templateBody :
A string that contains the full conformance pack template body. The
structure containing the template body has a minimum length of 1 byte and
a maximum length of 51,200 bytes.
Parameter templateS3Uri :
The location of the file containing the template body
(s3://bucketname/prefix). The uri must point to a conformance
pack template (max size: 300 KB) that is located in an Amazon S3 bucket in
the same Region as the conformance pack.
Parameter templateSSMDocumentDetails :
An object of type TemplateSSMDocumentDetails, which contains
the name or the Amazon Resource Name (ARN) of the Amazon Web Services
Systems Manager document (SSM document) and the version of the SSM
document that is used to create a conformance pack.
Implementation
Future<PutConformancePackResponse> putConformancePack({
required String conformancePackName,
List<ConformancePackInputParameter>? conformancePackInputParameters,
String? deliveryS3Bucket,
String? deliveryS3KeyPrefix,
List<Tag>? tags,
String? templateBody,
String? templateS3Uri,
TemplateSSMDocumentDetails? templateSSMDocumentDetails,
}) async {
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 (tags != null) 'Tags': tags,
if (templateBody != null) 'TemplateBody': templateBody,
if (templateS3Uri != null) 'TemplateS3Uri': templateS3Uri,
if (templateSSMDocumentDetails != null)
'TemplateSSMDocumentDetails': templateSSMDocumentDetails,
},
);
return PutConformancePackResponse.fromJson(jsonResponse.body);
}