software.amazon.awscdk.services.kms.CfnAliasProps Maven / Gradle / Ivy
Show all versions of kms Show documentation
package software.amazon.awscdk.services.kms;
/**
* Properties for defining a `CfnAlias`.
*
* 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.kms.*;
* CfnAliasProps cfnAliasProps = CfnAliasProps.builder()
* .aliasName("aliasName")
* .targetKeyId("targetKeyId")
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.60.0 (build ebcefe6)", date = "2022-07-09T01:30:40.367Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.kms.$Module.class, fqn = "@aws-cdk/aws-kms.CfnAliasProps")
@software.amazon.jsii.Jsii.Proxy(CfnAliasProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface CfnAliasProps extends software.amazon.jsii.JsiiSerializable {
/**
* Specifies the alias name. This value must begin with `alias/` followed by a name, such as `alias/ExampleAlias` .
*
*
*
* If you change the value of a Replacement
property, such as AliasName
, the existing alias is deleted and a new alias is created for the specified KMS key. This change can disrupt applications that use the alias. It can also allow or deny access to a KMS key affected by attribute-based access control (ABAC).
*
*
*
* The alias must be string of 1-256 characters. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). The alias name cannot begin with alias/aws/
. The alias/aws/
prefix is reserved for AWS managed keys .
*
* Pattern : alias/^[a-zA-Z0-9/_-]+$
*
* Minimum : 1
*
* Maximum : 256
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getAliasName();
/**
* Associates the alias with the specified [customer managed key](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk) . The KMS key must be in the same AWS account and Region.
*
* A valid key ID is required. If you supply a null or empty string value, this operation returns an error.
*
* For help finding the key ID and ARN, see Finding the key ID and ARN in the AWS Key Management Service Developer Guide .
*
* Specify the key ID or the key ARN of the KMS key.
*
* For example:
*
*
* - Key ID:
1234abcd-12ab-34cd-56ef-1234567890ab
* - Key ARN:
arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
*
*
* To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey .
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getTargetKeyId();
/**
* @return a {@link Builder} of {@link CfnAliasProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link CfnAliasProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String aliasName;
java.lang.String targetKeyId;
/**
* Sets the value of {@link CfnAliasProps#getAliasName}
* @param aliasName Specifies the alias name. This value must begin with `alias/` followed by a name, such as `alias/ExampleAlias` . This parameter is required.
*
*
* If you change the value of a Replacement
property, such as AliasName
, the existing alias is deleted and a new alias is created for the specified KMS key. This change can disrupt applications that use the alias. It can also allow or deny access to a KMS key affected by attribute-based access control (ABAC).
*
*
*
* The alias must be string of 1-256 characters. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). The alias name cannot begin with alias/aws/
. The alias/aws/
prefix is reserved for AWS managed keys .
*
* Pattern : alias/^[a-zA-Z0-9/_-]+$
*
* Minimum : 1
*
* Maximum : 256
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder aliasName(java.lang.String aliasName) {
this.aliasName = aliasName;
return this;
}
/**
* Sets the value of {@link CfnAliasProps#getTargetKeyId}
* @param targetKeyId Associates the alias with the specified [customer managed key](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk) . The KMS key must be in the same AWS account and Region. This parameter is required.
* A valid key ID is required. If you supply a null or empty string value, this operation returns an error.
*
* For help finding the key ID and ARN, see Finding the key ID and ARN in the AWS Key Management Service Developer Guide .
*
* Specify the key ID or the key ARN of the KMS key.
*
* For example:
*
*
* - Key ID:
1234abcd-12ab-34cd-56ef-1234567890ab
* - Key ARN:
arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
*
*
* To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey .
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder targetKeyId(java.lang.String targetKeyId) {
this.targetKeyId = targetKeyId;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link CfnAliasProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public CfnAliasProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link CfnAliasProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements CfnAliasProps {
private final java.lang.String aliasName;
private final java.lang.String targetKeyId;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.aliasName = software.amazon.jsii.Kernel.get(this, "aliasName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.targetKeyId = software.amazon.jsii.Kernel.get(this, "targetKeyId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.aliasName = java.util.Objects.requireNonNull(builder.aliasName, "aliasName is required");
this.targetKeyId = java.util.Objects.requireNonNull(builder.targetKeyId, "targetKeyId is required");
}
@Override
public final java.lang.String getAliasName() {
return this.aliasName;
}
@Override
public final java.lang.String getTargetKeyId() {
return this.targetKeyId;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("aliasName", om.valueToTree(this.getAliasName()));
data.set("targetKeyId", om.valueToTree(this.getTargetKeyId()));
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-kms.CfnAliasProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CfnAliasProps.Jsii$Proxy that = (CfnAliasProps.Jsii$Proxy) o;
if (!aliasName.equals(that.aliasName)) return false;
return this.targetKeyId.equals(that.targetKeyId);
}
@Override
public final int hashCode() {
int result = this.aliasName.hashCode();
result = 31 * result + (this.targetKeyId.hashCode());
return result;
}
}
}