putOrganizationConformancePack method
Deploys conformance packs across member accounts in an AWS Organization.
Only a master account and a delegated administrator can call this API.
When calling this API with a delegated administrator, you must ensure AWS
Organizations ListDelegatedAdministrator
permissions are
added.
This API enables organization service access for
config-multiaccountsetup.amazonaws.com
through the
EnableAWSServiceAccess
action and creates a service linked
role AWSServiceRoleForConfigMultiAccountSetup
in the master
or delegated administrator account of your organization. The service
linked role is created only when the role does not exist in the caller
account. To use this API with delegated administrator, register a
delegated administrator by calling AWS Organization
register-delegate-admin
for
config-multiaccountsetup.amazonaws.com
.
You must specify either the TemplateS3Uri
or the
TemplateBody
parameter, but not both. If you provide both AWS
Config uses the TemplateS3Uri
parameter and ignores the
TemplateBody
parameter.
AWS Config sets the state of a conformance pack to CREATE_IN_PROGRESS and UPDATE_IN_PROGRESS until the conformance pack is created or updated. You cannot update a conformance pack while it is in this state.
You can create 6 conformance packs with 25 AWS Config rules in each pack and 3 delegated administrator per organization.
May throw MaxNumberOfOrganizationConformancePacksExceededException. May throw ResourceInUseException. May throw ValidationException. May throw OrganizationAccessDeniedException. May throw InsufficientPermissionsException. May throw OrganizationConformancePackTemplateValidationException. May throw OrganizationAllFeaturesNotEnabledException. May throw NoAvailableOrganizationException.
Parameter organizationConformancePackName
:
Name of the organization conformance pack you want to create.
Parameter conformancePackInputParameters
:
A list of ConformancePackInputParameter
objects.
Parameter deliveryS3Bucket
:
Location of an Amazon S3 bucket where AWS Config can deliver evaluation
results. AWS Config stores intermediate files while processing conformance
pack template.
The delivery bucket name should start with awsconfigconforms. For example: "Resource": "arn:aws:s3:::your_bucket_name/*". For more information, see Permissions for cross account bucket access.
Parameter deliveryS3KeyPrefix
:
The prefix for the Amazon S3 bucket.
Parameter excludedAccounts
:
A list of AWS accounts to be excluded from an organization conformance
pack while deploying a conformance pack.
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. The uri must point to the
conformance pack template (max size: 300 KB).
Implementation
Future<PutOrganizationConformancePackResponse>
putOrganizationConformancePack({
required String organizationConformancePackName,
List<ConformancePackInputParameter>? conformancePackInputParameters,
String? deliveryS3Bucket,
String? deliveryS3KeyPrefix,
List<String>? excludedAccounts,
String? templateBody,
String? templateS3Uri,
}) async {
ArgumentError.checkNotNull(
organizationConformancePackName, 'organizationConformancePackName');
_s.validateStringLength(
'organizationConformancePackName',
organizationConformancePackName,
1,
128,
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.PutOrganizationConformancePack'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'OrganizationConformancePackName': organizationConformancePackName,
if (conformancePackInputParameters != null)
'ConformancePackInputParameters': conformancePackInputParameters,
if (deliveryS3Bucket != null) 'DeliveryS3Bucket': deliveryS3Bucket,
if (deliveryS3KeyPrefix != null)
'DeliveryS3KeyPrefix': deliveryS3KeyPrefix,
if (excludedAccounts != null) 'ExcludedAccounts': excludedAccounts,
if (templateBody != null) 'TemplateBody': templateBody,
if (templateS3Uri != null) 'TemplateS3Uri': templateS3Uri,
},
);
return PutOrganizationConformancePackResponse.fromJson(jsonResponse.body);
}