createPolicy
Creates a policy. A policy combines templates and rules with enforcement settings for a firewall type, such as AWS WAF or AWS Shield Advanced. Use isPublished to create the policy in published (ACTIVE) or draft (DRAFT) state.
Samples
// Creates a new WAF policy in draft state with a template association.
val resp = networkSecurityManagerClient.createPolicy {
clientToken = "550e8400-e29b-41d4-a716-446655440002"
policyName = "web-app-waf-policy"
policyDescription = "WAF policy for web application protection"
firewallType = PolicyFirewallType.fromValue("WAF")
priority = 1
associatedTemplateAndRuleList = listOf<TemplateOrRuleReference>(
TemplateOrRuleReference.TemplateIdentifier("arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789")
)
policyConfiguration = PolicyConfiguration {
remediationEnabled = false
resourcesCleanUp = false
wafConfig = WafConfig {
existingCustomerWebAclResolution = ExistingCustomerWebAclResolution.fromValue("NO_REMEDIATION")
conflictResolution = WafConflictResolutionOptions.fromValue("MERGE_WHERE_APPLICABLE")
}
}
isPublished = false
}Content copied to clipboard