
software.amazon.awscdk.services.dynamodb.GlobalSecondaryIndexProps Maven / Gradle / Ivy
package software.amazon.awscdk.services.dynamodb;
/**
* Properties for a global secondary index.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.13.0 (build 385c325)", date = "2020-10-23T23:57:07.056Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.dynamodb.$Module.class, fqn = "@aws-cdk/aws-dynamodb.GlobalSecondaryIndexProps")
@software.amazon.jsii.Jsii.Proxy(GlobalSecondaryIndexProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface GlobalSecondaryIndexProps extends software.amazon.jsii.JsiiSerializable, software.amazon.awscdk.services.dynamodb.SecondaryIndexProps {
/**
* The attribute of a partition key for the global secondary index.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.dynamodb.Attribute getPartitionKey();
/**
* The read capacity for the global secondary index.
*
* Can only be provided if table billingMode is Provisioned or undefined.
*
* Default: 5
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getReadCapacity() {
return null;
}
/**
* The attribute of a sort key for the global secondary index.
*
* Default: - No sort key
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.dynamodb.Attribute getSortKey() {
return null;
}
/**
* The write capacity for the global secondary index.
*
* Can only be provided if table billingMode is Provisioned or undefined.
*
* Default: 5
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getWriteCapacity() {
return null;
}
/**
* @return a {@link Builder} of {@link GlobalSecondaryIndexProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link GlobalSecondaryIndexProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
private software.amazon.awscdk.services.dynamodb.Attribute partitionKey;
private java.lang.Number readCapacity;
private software.amazon.awscdk.services.dynamodb.Attribute sortKey;
private java.lang.Number writeCapacity;
private java.lang.String indexName;
private java.util.List nonKeyAttributes;
private software.amazon.awscdk.services.dynamodb.ProjectionType projectionType;
/**
* Sets the value of {@link GlobalSecondaryIndexProps#getPartitionKey}
* @param partitionKey The attribute of a partition key for the global secondary index. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder partitionKey(software.amazon.awscdk.services.dynamodb.Attribute partitionKey) {
this.partitionKey = partitionKey;
return this;
}
/**
* Sets the value of {@link GlobalSecondaryIndexProps#getReadCapacity}
* @param readCapacity The read capacity for the global secondary index.
* Can only be provided if table billingMode is Provisioned or undefined.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder readCapacity(java.lang.Number readCapacity) {
this.readCapacity = readCapacity;
return this;
}
/**
* Sets the value of {@link GlobalSecondaryIndexProps#getSortKey}
* @param sortKey The attribute of a sort key for the global secondary index.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder sortKey(software.amazon.awscdk.services.dynamodb.Attribute sortKey) {
this.sortKey = sortKey;
return this;
}
/**
* Sets the value of {@link GlobalSecondaryIndexProps#getWriteCapacity}
* @param writeCapacity The write capacity for the global secondary index.
* Can only be provided if table billingMode is Provisioned or undefined.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder writeCapacity(java.lang.Number writeCapacity) {
this.writeCapacity = writeCapacity;
return this;
}
/**
* Sets the value of {@link GlobalSecondaryIndexProps#getIndexName}
* @param indexName The name of the secondary index. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder indexName(java.lang.String indexName) {
this.indexName = indexName;
return this;
}
/**
* Sets the value of {@link GlobalSecondaryIndexProps#getNonKeyAttributes}
* @param nonKeyAttributes The non-key attributes that are projected into the secondary index.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder nonKeyAttributes(java.util.List nonKeyAttributes) {
this.nonKeyAttributes = nonKeyAttributes;
return this;
}
/**
* Sets the value of {@link GlobalSecondaryIndexProps#getProjectionType}
* @param projectionType The set of attributes that are projected into the secondary index.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder projectionType(software.amazon.awscdk.services.dynamodb.ProjectionType projectionType) {
this.projectionType = projectionType;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link GlobalSecondaryIndexProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public GlobalSecondaryIndexProps build() {
return new Jsii$Proxy(partitionKey, readCapacity, sortKey, writeCapacity, indexName, nonKeyAttributes, projectionType);
}
}
/**
* An implementation for {@link GlobalSecondaryIndexProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements GlobalSecondaryIndexProps {
private final software.amazon.awscdk.services.dynamodb.Attribute partitionKey;
private final java.lang.Number readCapacity;
private final software.amazon.awscdk.services.dynamodb.Attribute sortKey;
private final java.lang.Number writeCapacity;
private final java.lang.String indexName;
private final java.util.List nonKeyAttributes;
private final software.amazon.awscdk.services.dynamodb.ProjectionType projectionType;
/**
* 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.partitionKey = this.jsiiGet("partitionKey", software.amazon.awscdk.services.dynamodb.Attribute.class);
this.readCapacity = this.jsiiGet("readCapacity", java.lang.Number.class);
this.sortKey = this.jsiiGet("sortKey", software.amazon.awscdk.services.dynamodb.Attribute.class);
this.writeCapacity = this.jsiiGet("writeCapacity", java.lang.Number.class);
this.indexName = this.jsiiGet("indexName", java.lang.String.class);
this.nonKeyAttributes = this.jsiiGet("nonKeyAttributes", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.projectionType = this.jsiiGet("projectionType", software.amazon.awscdk.services.dynamodb.ProjectionType.class);
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
private Jsii$Proxy(final software.amazon.awscdk.services.dynamodb.Attribute partitionKey, final java.lang.Number readCapacity, final software.amazon.awscdk.services.dynamodb.Attribute sortKey, final java.lang.Number writeCapacity, final java.lang.String indexName, final java.util.List nonKeyAttributes, final software.amazon.awscdk.services.dynamodb.ProjectionType projectionType) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.partitionKey = java.util.Objects.requireNonNull(partitionKey, "partitionKey is required");
this.readCapacity = readCapacity;
this.sortKey = sortKey;
this.writeCapacity = writeCapacity;
this.indexName = java.util.Objects.requireNonNull(indexName, "indexName is required");
this.nonKeyAttributes = nonKeyAttributes;
this.projectionType = projectionType;
}
@Override
public software.amazon.awscdk.services.dynamodb.Attribute getPartitionKey() {
return this.partitionKey;
}
@Override
public java.lang.Number getReadCapacity() {
return this.readCapacity;
}
@Override
public software.amazon.awscdk.services.dynamodb.Attribute getSortKey() {
return this.sortKey;
}
@Override
public java.lang.Number getWriteCapacity() {
return this.writeCapacity;
}
@Override
public java.lang.String getIndexName() {
return this.indexName;
}
@Override
public java.util.List getNonKeyAttributes() {
return this.nonKeyAttributes;
}
@Override
public software.amazon.awscdk.services.dynamodb.ProjectionType getProjectionType() {
return this.projectionType;
}
@Override
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("partitionKey", om.valueToTree(this.getPartitionKey()));
if (this.getReadCapacity() != null) {
data.set("readCapacity", om.valueToTree(this.getReadCapacity()));
}
if (this.getSortKey() != null) {
data.set("sortKey", om.valueToTree(this.getSortKey()));
}
if (this.getWriteCapacity() != null) {
data.set("writeCapacity", om.valueToTree(this.getWriteCapacity()));
}
data.set("indexName", om.valueToTree(this.getIndexName()));
if (this.getNonKeyAttributes() != null) {
data.set("nonKeyAttributes", om.valueToTree(this.getNonKeyAttributes()));
}
if (this.getProjectionType() != null) {
data.set("projectionType", om.valueToTree(this.getProjectionType()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-dynamodb.GlobalSecondaryIndexProps"));
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 boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GlobalSecondaryIndexProps.Jsii$Proxy that = (GlobalSecondaryIndexProps.Jsii$Proxy) o;
if (!partitionKey.equals(that.partitionKey)) return false;
if (this.readCapacity != null ? !this.readCapacity.equals(that.readCapacity) : that.readCapacity != null) return false;
if (this.sortKey != null ? !this.sortKey.equals(that.sortKey) : that.sortKey != null) return false;
if (this.writeCapacity != null ? !this.writeCapacity.equals(that.writeCapacity) : that.writeCapacity != null) return false;
if (!indexName.equals(that.indexName)) return false;
if (this.nonKeyAttributes != null ? !this.nonKeyAttributes.equals(that.nonKeyAttributes) : that.nonKeyAttributes != null) return false;
return this.projectionType != null ? this.projectionType.equals(that.projectionType) : that.projectionType == null;
}
@Override
public int hashCode() {
int result = this.partitionKey.hashCode();
result = 31 * result + (this.readCapacity != null ? this.readCapacity.hashCode() : 0);
result = 31 * result + (this.sortKey != null ? this.sortKey.hashCode() : 0);
result = 31 * result + (this.writeCapacity != null ? this.writeCapacity.hashCode() : 0);
result = 31 * result + (this.indexName.hashCode());
result = 31 * result + (this.nonKeyAttributes != null ? this.nonKeyAttributes.hashCode() : 0);
result = 31 * result + (this.projectionType != null ? this.projectionType.hashCode() : 0);
return result;
}
}
}