Class CfnPolicy
- All Implemented Interfaces:
IEnvironmentAware,IInspectable,ITaggable,IPolicyRef,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 ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.organizations.IPolicyRef
IPolicyRef.Jsii$Default, IPolicyRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnPolicy(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.A reference to a Policy resource.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.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetContent(Object value) The policy text content.voidsetDescription(String value) Human readable description of the policy.voidName of the policy.voidsetTagsRaw(List<CfnTag> value) A list of tags that you want to attach to the newly created policy.voidsetTargetIds(List<String> value) List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.voidThe 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, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IEnvironmentAware
getEnvMethods 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:
inspectin 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:
renderPropertiesin 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:
getCfnPropertiesin classCfnResource
-
getPolicyRef
A reference to a Policy resource.- Specified by:
getPolicyRefin interfaceIPolicyRef
-
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.
-