Skip to content

Key

This class encapsulates and extends the ROS resource type ALIYUN::KMS::Key, which is used to create a customer master key (CMK).

Initializers

import com.aliyun.ros.cdk.kms.Key;
Key.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
//  .description(java.lang.String)
//  .description(IResolvable)
//  .dkmsInstanceId(java.lang.String)
//  .dkmsInstanceId(IResolvable)
//  .enable(java.lang.Boolean)
//  .enable(IResolvable)
//  .enableAutomaticRotation(java.lang.Boolean)
//  .enableAutomaticRotation(IResolvable)
//  .keySpec(java.lang.String)
//  .keySpec(IResolvable)
//  .keyUsage(java.lang.String)
//  .keyUsage(IResolvable)
//  .pendingWindowInDays(java.lang.Number)
//  .pendingWindowInDays(IResolvable)
//  .policy(IResolvable)
//  .policy(java.util.Map<java.lang.String, java.lang.Object>)
//  .protectionLevel(java.lang.String)
//  .protectionLevel(IResolvable)
//  .rotationInterval(java.lang.String)
//  .rotationInterval(IResolvable)
    .build();
Name Type Description
scope com.aliyun.ros.cdk.core.Construct No description.
id java.lang.String No description.
enableResourcePropertyConstraint java.lang.Boolean No description.
description java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property description: The description of the CMK.
dkmsInstanceId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property dkmsInstanceId: The ID of the dedicated KMS instance.
enable java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property enable: Specifies whether the key is enabled.
enableAutomaticRotation java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property enableAutomaticRotation: Whether to enable automatic key rotation.
keySpec java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property keySpec: Key type.
keyUsage java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property keyUsage: The usage of the CMK.
pendingWindowInDays java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property pendingWindowInDays: The waiting period, specified in number of days.
policy com.aliyun.ros.cdk.core.IResolvable OR java.util.Map Property policy: The policy of key.
protectionLevel java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property protectionLevel: The protection level of the CMK to create.
rotationInterval java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property rotationInterval: The time period for automatic rotation.

scopeRequired

  • Type: com.aliyun.ros.cdk.core.Construct

idRequired

  • Type: java.lang.String

enableResourcePropertyConstraintOptional

  • Type: java.lang.Boolean

descriptionOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property description: The description of the CMK.

Length constraints: Minimum length of 0 characters. Maximum length of 8192 characters.


dkmsInstanceIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property dkmsInstanceId: The ID of the dedicated KMS instance.


enableOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property enable: Specifies whether the key is enabled.

Defaults to true.


enableAutomaticRotationOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property enableAutomaticRotation: Whether to enable automatic key rotation.

Valid value: true/false (default)


keySpecOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property keySpec: Key type.

Valid value: Aliyun_AES_256/Aliyun_SM4/RSA_2048/EC_P256/EC_P256K/EC_SM2


keyUsageOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property keyUsage: The usage of the CMK.

Valid values: ENCRYPT/DECRYPT: encrypts or decrypts data. SIGN/VERIFY: generates or verifies a digital signature. If the CMK supports signature verification, the default value is SIGN/VERIFY. If the CMK does not support signature verification, the default value is ENCRYPT/DECRYPT.


pendingWindowInDaysOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property pendingWindowInDays: The waiting period, specified in number of days.

During this period, you can cancel the CMK in PendingDeletion status. After the waiting period expires, you cannot cancel the deletion. The value must be between 7 and 366. Default value is 30.


policyOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.Map

Property policy: The policy of key.


protectionLevelOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property protectionLevel: The protection level of the CMK to create.

Valid value: SOFTWARE and HSM. When this parameter is set to HSM: If the Origin parameter is set to Aliyun_KMS, the CMK is created in Managed HSM. If the Origin parameter is set to EXTERNAL, you can import external keys to Managed HSM.


rotationIntervalOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property rotationInterval: The time period for automatic rotation.

The format is integer[unit], where integer represents the length of time and unit represents the time unit. The legal unit units are: d (day), h (hour), m (minute), s (second). 7d or 604800s both represent a 7-day cycle. Value: 7~730 days.


Methods

Name Description
toString Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
addCondition No description.
addCount No description.
addDependency No description.
addResourceDesc No description.
applyRemovalPolicy No description.
getAtt No description.
setMetadata No description.

toString

public java.lang.String toString()

Returns a string representation of this construct.

synthesize

public void synthesize(ISynthesisSession session)

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

  • Type: com.aliyun.ros.cdk.core.ISynthesisSession

The synthesis session.


addCondition

public void addCondition(RosCondition condition)

conditionRequired

  • Type: com.aliyun.ros.cdk.core.RosCondition

addCount

public void addCount(java.lang.Number OR IResolvable count)

countRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

addDependency

public void addDependency(Resource resource)

resourceRequired

  • Type: com.aliyun.ros.cdk.core.Resource

addResourceDesc

public void addResourceDesc(java.lang.String desc)

descRequired

  • Type: java.lang.String

applyRemovalPolicy

public void applyRemovalPolicy(RemovalPolicy policy)

policyRequired

  • Type: com.aliyun.ros.cdk.core.RemovalPolicy

getAtt

public IResolvable getAtt(java.lang.String name)

nameRequired

  • Type: java.lang.String

setMetadata

public void setMetadata(java.lang.String key, java.lang.Object value)

keyRequired

  • Type: java.lang.String

valueRequired

  • Type: java.lang.Object

Static Functions

Name Description
isConstruct Return whether the given object is a Construct.

isConstruct

import com.aliyun.ros.cdk.kms.Key;
Key.isConstruct(java.lang.Object x)

Return whether the given object is a Construct.

xRequired

  • Type: java.lang.Object

Properties

Name Type Description
node com.aliyun.ros.cdk.core.ConstructNode The construct tree node associated with this construct.
ref java.lang.String No description.
stack com.aliyun.ros.cdk.core.Stack The stack in which this resource is defined.
resource com.aliyun.ros.cdk.core.RosResource No description.
attrKeyId com.aliyun.ros.cdk.core.IResolvable Attribute KeyId: The globally unique identifier for the CMK.

nodeRequired

public ConstructNode getNode();
  • Type: com.aliyun.ros.cdk.core.ConstructNode

The construct tree node associated with this construct.


refRequired

public java.lang.String getRef();
  • Type: java.lang.String

stackRequired

public Stack getStack();
  • Type: com.aliyun.ros.cdk.core.Stack

The stack in which this resource is defined.


resourceOptional

public RosResource getResource();
  • Type: com.aliyun.ros.cdk.core.RosResource

attrKeyIdRequired

public IResolvable getAttrKeyId();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute KeyId: The globally unique identifier for the CMK.