@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:39.103Z") public class CfnPolicy extends CfnResource implements IInspectable
Creates a policy of a specified type that you can attach to a root, an organizational unit (OU), or an individual AWS account .
For more information about policies and their use, see Managing Organization Policies .
If the request includes tags, then the requester must have the organizations:TagResource
permission.
This operation can be called only from the organization's management account.
Before you can create a policy of a given type, you must first enable that policy type in your organization.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.organizations.*; Object content; CfnPolicy cfnPolicy = CfnPolicy.Builder.create(this, "MyCfnPolicy") .content(content) .name("name") .type("type") // the properties below are optional .description("description") .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .targetIds(List.of("targetIds")) .build();
Modifier and Type | Class and Description |
---|---|
static class |
CfnPolicy.Builder
A fluent builder for
CfnPolicy . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnPolicy(Construct scope,
java.lang.String id,
CfnPolicyProps props)
Create a new `AWS::Organizations::Policy`.
|
protected |
CfnPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnPolicy(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrArn()
Returns the Amazon Resource Name (ARN) of the policy.
|
IResolvable |
getAttrAwsManaged()
Returns a boolean value that indicates whether the specified policy is an AWS managed policy.
|
java.lang.String |
getAttrId()
Returns the unique identifier (ID) of the policy.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.Object |
getContent()
The policy text content.
|
java.lang.String |
getDescription()
Human readable description of the policy.
|
java.lang.String |
getName()
Name of the policy.
|
TagManager |
getTags()
A list of tags that you want to attach to the newly created policy.
|
java.util.List<java.lang.String> |
getTargetIds()
List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.
|
java.lang.String |
getType()
The type of policy to create.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setContent(java.lang.Object value)
The policy text content.
|
void |
setDescription(java.lang.String value)
Human readable description of the policy.
|
void |
setName(java.lang.String value)
Name of the policy.
|
void |
setTargetIds(java.util.List<java.lang.String> value)
List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.
|
void |
setType(java.lang.String value)
The type of policy to create.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnPolicy(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnPolicy(Construct scope, java.lang.String id, CfnPolicyProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrArn()
For example: arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111
.
public IResolvable getAttrAwsManaged()
If true, then you can attach the policy to roots, OUs, or accounts, but you cannot edit it. For example: true | false
.
public java.lang.String getAttrId()
For example: p-examplepolicyid111
.
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public TagManager getTags()
For each tag in the list, you must specify both a tag key and a value. You can set the value to an empty string, but you can't set it to null
. For more information about tagging, see Tagging AWS Organizations resources in the AWS Organizations User Guide.
If any one of the tags is not valid or if you exceed the allowed number of tags for a policy, then the entire request fails and the policy is not created.
public java.lang.Object getContent()
When you specify the policy content as a JSON string, you can't perform drift detection on the CloudFormation stack. For this reason, we recommend specifying the policy content as a JSON object instead.
The text that you supply must adhere to the rules of the policy type you specify in the Type
parameter. The following AWS Organizations quotas are enforced for the maximum size of a policy document:
For more information about Organizations service quotas, see Quotas for AWS Organizations in the AWS Organizations User Guide .
public void setContent(java.lang.Object value)
When you specify the policy content as a JSON string, you can't perform drift detection on the CloudFormation stack. For this reason, we recommend specifying the policy content as a JSON object instead.
The text that you supply must adhere to the rules of the policy type you specify in the Type
parameter. The following AWS Organizations quotas are enforced for the maximum size of a policy document:
For more information about Organizations service quotas, see Quotas for AWS Organizations in the AWS Organizations User Guide .
public java.lang.String getName()
The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.
public void setName(java.lang.String value)
The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.
public java.lang.String getType()
public void setType(java.lang.String value)
public java.lang.String getDescription()
public void setDescription(java.lang.String value)
public java.util.List<java.lang.String> getTargetIds()
You can get the ID by calling the ListRoots , ListOrganizationalUnitsForParent , or ListAccounts operations. If you don't specify this parameter, the policy is created but not attached to any organization resource.
The regex pattern for a target ID string requires one of the following:
public void setTargetIds(java.util.List<java.lang.String> value)
You can get the ID by calling the ListRoots , ListOrganizationalUnitsForParent , or ListAccounts operations. If you don't specify this parameter, the policy is created but not attached to any organization resource.
The regex pattern for a target ID string requires one of the following: