Class CfnPolicy
- All Implemented Interfaces:
IInspectable
,ITaggable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
For more information about policies and their use, see Managing AWS Organizations 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 or a member account designated as a delegated administrator.
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();
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnPolicy
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnPolicy
(software.amazon.jsii.JsiiObjectRef objRef) CfnPolicy
(software.constructs.Construct scope, String id, CfnPolicyProps props) -
Method Summary
Modifier and TypeMethodDescriptionReturns the Amazon Resource Name (ARN) of the policy.Returns a boolean value that indicates whether the specified policy is an AWS managed policy.Returns the unique identifier (ID) of the policy.The policy text content.Human readable description of the policy.getName()
Name of the policy.getTags()
Tag Manager which manages the tags for this resource.A list of tags that you want to attach to the newly created policy.List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.getType()
The type of policy to create.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setContent
(Object value) The policy text content.void
setDescription
(String value) Human readable description of the policy.void
Name of the policy.void
setTagsRaw
(List<CfnTag> value) A list of tags that you want to attach to the newly created policy.void
setTargetIds
(List<String> value) List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.void
The type of policy to create.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnPolicy
protected CfnPolicy(software.amazon.jsii.JsiiObjectRef objRef) -
CfnPolicy
protected CfnPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnPolicy
@Stability(Stable) public CfnPolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnPolicyProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrArn
Returns the Amazon Resource Name (ARN) of the policy.For example:
arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111
. -
getAttrAwsManaged
Returns a boolean value that indicates whether the specified policy is an AWS managed policy.If true, then you can attach the policy to roots, OUs, or accounts, but you cannot edit it. For example:
true | false
. -
getAttrId
Returns the unique identifier (ID) of the policy.For example:
p-examplepolicyid111
. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
Tag Manager which manages the tags for this resource. -
getContent
The policy text content.You can specify the policy content as a JSON object or a JSON string.
-
setContent
The policy text content.You can specify the policy content as a JSON object or a JSON string.
-
getName
Name of the policy. -
setName
Name of the policy. -
getType
The type of policy to create. -
setType
The type of policy to create. -
getDescription
Human readable description of the policy. -
setDescription
Human readable description of the policy. -
getTagsRaw
A list of tags that you want to attach to the newly created policy. -
setTagsRaw
A list of tags that you want to attach to the newly created policy. -
getTargetIds
List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to. -
setTargetIds
List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.
-