update_policy
¶
update_policy(
policy_identifier: PolicyIdentifier,
update_token: UpdateToken,
is_published: IsPublished,
*,
config_overrides: Optional[NetworkSecurityManagerClientConfig] = None,
policy_description: Optional[Description] = None,
priority: Optional[Priority] = None,
associated_template_and_rule_list: Optional[TemplateAndRuleReferenceList] = None,
policy_configuration: Optional[PolicyConfiguration] = None,
client_token: Optional[IdempotencyToken] = None,
) -> UpdatePolicyOutput
Updates the specified policy. To prevent conflicting concurrent updates, provide the current updateToken. Use isPublished to publish the update or keep the policy as a draft.
Parameters:
-
policy_identifier(PolicyIdentifier) –The identifier of the policy. This is the policy's Amazon Resource Name (ARN).
-
update_token(UpdateToken) –A token used for optimistic concurrency control. Each read and write returns an
updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications. -
policy_description(Optional[Description], default:None) –A description of the policy.
-
priority(Optional[Priority], default:None) –The priority of the resource. A lower number indicates a higher priority.
-
associated_template_and_rule_list(Optional[TemplateAndRuleReferenceList], default:None) –The templates and rules to associate with the policy. For AWS WAF policies, specify 1 to 100 templates or rules, of which at most 2 can be templates. For AWS Shield Advanced policies, this list must be empty.
-
policy_configuration(Optional[PolicyConfiguration], default:None) –The configuration settings that control the policy's behavior, including remediation and firewall-type-specific settings.
-
is_published(IsPublished) –Specifies whether to publish the resource. When
true, the resource is saved in published (ACTIVE) state. Whenfalse, it is saved as a draft (DRAFT). -
client_token(Optional[IdempotencyToken], default:None) –A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.
Raises:
-
AccessDeniedException–You do not have sufficient permissions to perform this action.
-
ConflictException–The request conflicts with the current state of the resource. For example, the resource was modified concurrently, or it is in a state that does not allow the requested operation.
-
InternalServerException–The request processing failed because of an internal error in the service. This is a retryable error.
-
ResourceNotFoundException–The specified resource was not found. Verify that the resource identifier is correct and that the resource exists, then try your request again.
-
ServiceQuotaExceededException–The request would exceed a service quota.
-
ThrottlingException–The request was denied because of request throttling. Reduce your request rate and try again.
-
ValidationException–The request failed validation. For details, see the
reasonandfieldListmembers of the response. -
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Update a policy and publish it Updates the policy's description, priority, and configuration and publishes the change. The updateToken from the most recent read is required for optimistic locking.
>>> client.update_policy(policy_identifier='arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789', update_token='e3f4a5b6-6c7d-4e8f-9a0b-0c1d2e3f4a5b', policy_description='WAF policy for web application protection - updated', priority=2, associated_template_and_rule_list=[{'templateIdentifier': 'arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789'}], policy_configuration={'remediationEnabled': True, 'resourcesCleanUp': False, 'wafConfig': {'existingCustomerWebACLResolution': 'NO_REMEDIATION', 'conflictResolution': 'MERGE_WHERE_APPLICABLE'}}, is_published=True)
Source code in docs_src/capo_network_security_manager/_services/network_security_manager.py
1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 | |