create_policy_version¶
Operation¶
create_policy_version
async
¶
create_policy_version(input: CreatePolicyVersionInput, plugins: list[Plugin] | None = None) -> CreatePolicyVersionOutput
Creates a new version of the specified managed policy. To update a managed policy, you create a new policy version. A managed policy can have up to five versions. If the policy has five versions, you must delete an existing version using DeletePolicyVersion before you create a new version.
Optionally, you can set the new version as the policy's default version. The default version is the version that is in effect for the IAM users, groups, and roles to which the policy is attached.
For more information about managed policy versions, see Versioning for managed policies in the IAM User Guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
CreatePolicyVersionInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
CreatePolicyVersionOutput
|
An instance of |
Input¶
CreatePolicyVersionInput
dataclass
¶
Bases: _SerdeShape
Dataclass for CreatePolicyVersionInput structure.
Attributes¶
policy_arn
class-attribute
instance-attribute
¶
policy_arn: str | None = ...
The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
policy_document
class-attribute
instance-attribute
¶
policy_document: str | None = ...
The JSON policy document that you want to use as the content for this
new version of the policy.
You must provide policies in JSON format in IAM. However, for
CloudFormation templates formatted in YAML, you can provide the policy
in JSON or YAML format. CloudFormation always converts a YAML policy to
JSON format before submitting it to IAM.
The maximum length of the policy document that you can pass in this
operation, including whitespace, is listed below. To view the maximum
character counts of a managed policy with no whitespaces, see [IAM and
STS character
quotas](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entity-length).
The [regex pattern](http://wikipedia.org/wiki/regex) used to validate
this parameter is a string of characters consisting of the following:
- Any printable ASCII character ranging from the space character
(` `) through the end of the ASCII character range
- The printable characters in the Basic Latin and Latin-1 Supplement
character set (through `ΓΏ`)
- The special characters tab (` `), line feed (`
), and
carriage return (
`)
set_as_default
class-attribute
instance-attribute
¶
set_as_default: bool = ...
Specifies whether to set this version as the policy's default version.
When this parameter is true, the new policy version becomes the
operative version. That is, it becomes the version that is in effect for
the IAM users, groups, and roles that the policy is attached to.
For more information about managed policy versions, see Versioning for managed policies in the IAM User Guide.
Output¶
CreatePolicyVersionOutput
dataclass
¶
Bases: _SerdeShape
Contains the response to a successful CreatePolicyVersion request.
Attributes¶
policy_version
class-attribute
instance-attribute
¶
A structure containing details about the new policy version.
response_metadata
class-attribute
instance-attribute
¶
Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.